cant build react project, need more updated node version

azka-zaydan
HOBBY

3 months ago

error minimatch@10.0.3: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "18.20.5"

error Found incompatible module.

info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

✕ [stage-0 11/15] RUN --mount=type=cache,id=s/024f8f70-d263-4ee3-954c-7bb818a24faf-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile

process "/bin/bash -ol pipefail -c yarn install --frozen-lockfile" did not complete successfully: exit code: 1

Dockerfile:26

-------------------

24 | ENV NIXPACKS_PATH=/app/node_modules/.bin:$NIXPACKS_PATH

25 | COPY . /app/.

26 | >>> RUN --mount=type=cache,id=s/024f8f70-d263-4ee3-954c-7bb818a24faf-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile

27 |

28 | # build phase

-------------------

ERROR: failed to build: failed to solve: process "/bin/bash -ol pipefail -c yarn install --frozen-lockfile" did not complete successfully: exit code: 1

Error: Docker build failed

cant seem to build project because the dockerfile its using is using an older node version, how do i change the dockerfile or just the node version its using?

Solved$10 Bounty

11 Replies

Is this your Dockerfile or are you using Railpack?


smolpaw
HOBBY

3 months ago

About the incompatible node version, nixpacks defaulted to node 18 when I first deployed to railway. Find a way to maybe either specify node version for nixpacks if that's possible or use dockerfile deployment
I could help you with that if I had more information about your project and structure.


loudbook

Is this your Dockerfile or are you using Railpack?

azka-zaydan
HOBBY

3 months ago

its the default dockerfile from railway, so i assume it is railpack


smolpaw

About the incompatible node version, nixpacks defaulted to node 18 when I first deployed to railway. Find a way to maybe either specify node version for nixpacks if that's possible or use dockerfile deploymentI could help you with that if I had more information about your project and structure.

azka-zaydan
HOBBY

3 months ago

where should i start regarding the nixpacks?


anggol23
FREE

3 months ago

Based on the error message you provided, the problem is very clear: the minimatch@10.0.3 package requires Node.js version "20 || >=22", but your current environment (likely inside a Docker container) is using Node.js version "18.20.5".


smolpaw
HOBBY

3 months ago

Quickest way would be to set the env NIXPACKS_NODE_VERSION to 23 as specified here : https://nixpacks.com/docs/providers/node


smolpaw
HOBBY

3 months ago

Then rebuild. Make sure you go check the build details to see if railway is actually using the env during build time because we don't need this env on runtime just build time
On runtime it will simply be ignored


smolpaw

Quickest way would be to set the env NIXPACKS_NODE_VERSION to 23 as specified here : https://nixpacks.com/docs/providers/node

azka-zaydan
HOBBY

3 months ago

tried this, didnt work and it ended up using 18 during build


azka-zaydan
HOBBY

3 months ago

thanks for the help everyone, i decided to use railpack and it worked, i tried changing node version via env for nixpacks, couldnt get node version 23 to work


azka-zaydan

tried this, didnt work and it ended up using 18 during build

smolpaw
HOBBY

3 months ago

Kind of expected that, hence the second reply about actually checking it.
Happened to me too, railway needs to be told to use the env during build time and won't supply it as it is

I don't know how to supply that when using nixpacks but the link i gave also mentions other ways to specify the node version and one of the ways is doing it in your package.json file


smolpaw
HOBBY

3 months ago

If you need the actual code to be inserted into package.json, it's just this

{

"engines": {

"node": "23"

}

}


Status changed to Solved chandrika 3 months ago