Set Railpack Node Version
jwaltz
PROOP

7 months ago

Anyone know how to set the RAILPACKNODEVERSION? I tried as a service variable but it didn't seem to have an effect. Oops, Node v18.19.0 detected even thought I set the version to 22. This is for a service that Railpack detects as bun@1.2.17.

Solved

16 Replies

jwaltz
PROOP

7 months ago

7440ea60-c734-47cc-ba5d-e8cabf480488


dev
MODERATOR

7 months ago

Maybe you have it set as node 18 in your package.json engine field?


jwaltz
PROOP

7 months ago

  "engines": {
    "node": ">=20.0.0"
  },

dev
MODERATOR

7 months ago

interesting <:Thinking:1360710341239242762>


dev
MODERATOR

7 months ago

well it defaults to node 22 regardless so it must be overwritten somewhere, also make sure a .nvmrc file isn't overwriting it


jwaltz
PROOP

7 months ago

Don't have a .nvmrc. Hmm, it defaults to Node 22 even for the bun-specific Railpack?


jwaltz
PROOP

7 months ago

https://railpack.com/languages/node
When using Node it says defaults to 22 but when using Bun it doesn't list a Node version default.

When Node.js isn’t required in the final image but is needed during installation (for native modules), a basic Node.js version will be installed from apt packages.

The build logs show this occurring.


jwaltz
PROOP

7 months ago

Is there a way to install a higher version of Node when using a Bun-based Railpack?


dev
MODERATOR

7 months ago

I'm not sure, at the very least the docs dont state otherwise it only says Node 22 is the default


dev
MODERATOR

7 months ago

Perhaps it'd be worthwhile creating a Dockerfile for your app <:Thinking:1360710341239242762>


jwaltz
PROOP

7 months ago

I was hoping not to


jwaltz
PROOP

7 months ago

Railpack mentions If any script in your package.json contains node it will install Node so I added: "donotuse": "node --version" (absolutely horrible, I know)

The build logs show: node │ 20.19.3 │ package.json > engines > node (>=20.0.0)

Seems like it worked as a workaround to get a higher version of Node installed.


dev
MODERATOR

7 months ago

oh neat, thanks for sharing


dev
MODERATOR

7 months ago

well not perfect


jwaltz
PROOP

7 months ago

Some creativity. not perfect indeed. hope someone else can benefit with this esoteric knowledge, glad to share!

Thanks for your help!


jr
EMPLOYEE

7 months ago

This is an interesting use case. We should respect the RAILPACK_NODE_VERSION variable when installing node when using it for Bun.


Status changed to Solved dev 7 months ago


Loading...