How do you properly set the node version that you want?

In my package.json, I have:
"engines": {
"node": "20.x",
"pnpm": "8.x"
},
"engines": {
"node": "20.x",
"pnpm": "8.x"
},
but when I do a build in railway, I see: According to Nixpacks docs here: https://nixpacks.com/docs/providers/node The node version should have been overridden by my engines.node? The docs also say that 18 should be default, but I see 16x used in railway. Where is the disconnect here?
Node | Nixpacks
App source + Nix packages + Docker = Image
No description
25 Replies
Percy
Percy10mo ago
Project ID: N/A
Ryan The Temp
Ryan The TempOP10mo ago
N/A
Brody
Brody10mo ago
do you have a NIXPACKS_NODE_VERSION variable?
Ryan The Temp
Ryan The TempOP10mo ago
I do not, here is my pid: 8839d035-4f03-41e7-b7ae-aa753f385754
Brody
Brody10mo ago
something else that would set the node version? nvmrc file maybe
Ryan The Temp
Ryan The TempOP10mo ago
no, I usse asdf-vm on my local to set the node version for the project, and it has a .tool-version and the contents of that file is:
nodejs 20.9.0
nodejs 20.9.0
Is there a way to know from the logs, where the node version is comfing from? I do see this warn in the log:
#10 1.391  WARN  Unsupported engine: wanted: {"node":"20"} (current: {"node":"v16.18.1","pnpm":"8.15.1"})
#10 1.391  WARN  Unsupported engine: wanted: {"node":"20"} (current: {"node":"v16.18.1","pnpm":"8.15.1"})
probably the culprit
Brody
Brody10mo ago
its coming from something in your repo share your repo?
Ryan The Temp
Ryan The TempOP10mo ago
its a private repo, so I can't really sahre it I wonder why it says that node 20 is unsupported though, its supposed to be supported accorindg to nixpacks docs
Brody
Brody10mo ago
maybe try just 20
Ryan The Temp
Ryan The TempOP10mo ago
what do you mean? that's what it is
Brody
Brody10mo ago
its not
No description
Ryan The Temp
Ryan The TempOP10mo ago
I tried both.
"engines": {
"node": "20.x",
"pnpm": "8.x"
},
"engines": {
"node": "20.x",
"pnpm": "8.x"
},
and
"engines": {
"node": "20",
"pnpm": "8.x"
},
"engines": {
"node": "20",
"pnpm": "8.x"
},
I just tried 20.x and I see:
#10 1.478  WARN  Unsupported engine: wanted: {"node":"20.x"} (current: {"node":"v16.18.1","pnpm":"8.15.1"})
#10 1.478  WARN  Unsupported engine: wanted: {"node":"20.x"} (current: {"node":"v16.18.1","pnpm":"8.15.1"})
Brody
Brody10mo ago
something in your repo is setting node to 16
Ryan The Temp
Ryan The TempOP10mo ago
Does it have something to do with nixpacks version in railway? I notice its a older version
Brody
Brody10mo ago
what version is it set to
Ryan The Temp
Ryan The TempOP10mo ago
well, from the logs I can see its: Nixpacks v1.15.0 but I'm not setting it anywhere myself I also tried setting NIXPACKS_NODE_VERSION variable to 20.x and it still doesn't work keeps using v16 for some reason
Brody
Brody10mo ago
dont think nixpacks v1.15.0 supports node 20, but you would be setting that somewhere too, likely in a railway.json/toml
Ryan The Temp
Ryan The TempOP10mo ago
I tried setting it to 18, in my package.json file and see:
#10 0.978  WARN  Unsupported engine: wanted: {"node":"18"} (current: {"node":"v16.18.1","pnpm":"8.15.1"})
#10 0.978  WARN  Unsupported engine: wanted: {"node":"18"} (current: {"node":"v16.18.1","pnpm":"8.15.1"})
I can't be setting it to v16 in my code, otherwise I wouldn't show that warninig, or even say that 18 is not supported
Brody
Brody10mo ago
^
Ryan The Temp
Ryan The TempOP10mo ago
should I be specifying a nixpacks version in railway.toml? or does it just use the latest by default?
Brody
Brody10mo ago
you are specifying it somewhere already, thats why its not the latest
Ryan The Temp
Ryan The TempOP10mo ago
ok, checked railway.toml, looks like nixpacks version was there. should I take it out, or just set it to the latest? 🤔
Brody
Brody10mo ago
take it out
Ryan The Temp
Ryan The TempOP10mo ago
ok, let me try that n now* perfect, looks like that did the trick 🙂 thanks 🙏
Brody
Brody10mo ago
no problem
Want results from more Discord servers?
Add your server