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

42 messages · Page 1 of 1 (latest)

queen temple
#

In my package.json, I have:

  "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?

compact shadowBOT
#

Project ID: N/A

queen temple
#

N/A

slim needle
#

do you have a NIXPACKS_NODE_VERSION variable?

queen temple
#

I do not,

#

here is my pid: 8839d035-4f03-41e7-b7ae-aa753f385754

slim needle
#

something else that would set the node version? nvmrc file maybe

queen temple
#

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
#

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"})
#

probably the culprit

slim needle
#

its coming from something in your repo

#

share your repo?

queen temple
#

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

slim needle
#

maybe try just 20

queen temple
#

what do you mean?

#

that's what it is

slim needle
#

its not

queen temple
#

I tried both.

  "engines": {
    "node": "20.x",
    "pnpm": "8.x"
  },

and

  "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"})
slim needle
#

something in your repo is setting node to 16

queen temple
#

Does it have something to do with nixpacks version in railway? I notice its a older version

slim needle
#

what version is it set to

queen temple
#

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

slim needle
#

dont think nixpacks v1.15.0 supports node 20, but you would be setting that somewhere too, likely in a railway.json/toml

queen temple
#

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"})

#

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

queen temple
#

should I be specifying a nixpacks version in railway.toml? or does it just use the latest by default?

slim needle
#

you are specifying it somewhere already, thats why its not the latest

queen temple
#

ok, checked railway.toml, looks like nixpacks version was there.

should I take it out, or just set it to the latest?

#

🤔

slim needle
#

take it out

queen temple
#

ok, let me try that n

#

now*

#

perfect, looks like that did the trick 🙂

#

thanks 🙏