Angular 20 Node version for Nixpacks

kmlindgren10
HOBBY

2 months ago

I'm attempting to update my app to use Angular 20 and it's currently using Nixpacks. Nixpacks uses 22.11.0 but Angular 20 requires 22.12 or higher. My package.json engine specifies 22.15.1. Is it possible for Nixpacks to use 22.12 or higher?

"engines": {
    "node": "22.15.1",

Error message:

npm warn config production Use --omit=dev instead.
> finance-app-frontend@0.0.0 config

> node set-prod-env.js

Angular environment.prod.ts file generated

Node.js version v22.11.0 detected.

The Angular CLI requires a minimum Node.js version of v20.19 or v22.12.

Please update your Node.js version or visit https://nodejs.org/ for additional instructions.
$10 Bounty

3 Replies

2 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody about 2 months ago


2 months ago

Use nixpacks.toml to specify Node 22.15.1

Create a file called nixpacks.toml in the root of your project:

[variables] NODE_VERSION = "22.15.1"

This instructs Nixpacks to install Node.js 22.15.1 from the Nix package repository, even if the base image uses something older.

Make sure your package.json still includes:

"engines": { "node": "22.15.1" }

Bonus: Confirm it’s working (via logs or shell)

After deploying, you can add a simple command in your build or postinstall script to confirm the correct version is in use:

"scripts": { "postinstall": "node -v" }

In Railway’s deploy logs, you should then see:


samcodes1

Use nixpacks.toml to specify Node 22.15.1Create a file called nixpacks.toml in the root of your project:[variables] NODE_VERSION = "22.15.1"This instructs Nixpacks to install Node.js 22.15.1 from the Nix package repository, even if the base image uses something older.Make sure your package.json still includes:"engines": { "node": "22.15.1" }Bonus: Confirm it’s working (via logs or shell)After deploying, you can add a simple command in your build or postinstall script to confirm the correct version is in use:"scripts": { "postinstall": "node -v" }In Railway’s deploy logs, you should then see:v22.15.1

gummiees
HOBBY

a month ago

I have done as such and it still does not work.

package.json:

  "engines": {
    "node": "22.15.1"
  }

nixpacks.toml:
[variables]
NODE_VERSION = "22.15.1"

even .nvmrc:
22.15.1

I have set the npm run build command to execute
node -v && ng build

and indeed it does still uses node v22.11. Output:
> node -v && ng build

v22.11.0

Node.js version v22.11.0 detected.

The Angular CLI requires a minimum Node.js version of v20.19 or v22.12.

Please update your Node.js version or visit https://nodejs.org/ for additional instructions.


gummiees
HOBBY

a month ago

I found the solution here https://station.railway.com/questions/lts-node-22-outdated-cd1c8c09.

I have set nixpacks.toml to have:

[phases.setup]

nixpkgsArchive = '373d6a14e460f2a1fc8859aeeda11d955487ed37' # 22.17.0 - https://github.com/NixOS/nixpkgs/commit/373d6a14e460f2a1fc8859aeeda11d955487ed37

which is the last version on nixpkgs master branch.


Angular 20 Node version for Nixpacks - Railway Help Station