Solved: Error on Yarn Install in Docker

cflattumPRO

3 months ago

✕ [stage-0 6/10] RUN --mount=type=cache,id=s/029be932-46f3-431c-92b0-4c66e46cae69-/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

I am building this project and keep getting to this error - yarn install is failing because of this package called glob@11.0.1. I am not explictly installing this, but think it is coming as a submodule package?

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

Interesting, when I set the root directory to /src, it builds, but cannot deploy as it can't see package.json (obviously). / is my root directory with src inside it, so I am not sure what the issue is!

project:
risklessbackend is the overall /, and have src folder and package.json and other files/folders as well. I am using yarn on my end and have this package json:

// package.json:
{
"name": "riskless-backend",
"version": "0.1.0",
"scripts": {
"dev": "tsc --watch & nodemon dist/main.js",
"build": "tsc",
"migrate": "node-pg-migrate up --dir=src/db/migrations --file-extension ts --tsconfig tsconfig.json",
"migrate:down": "node-pg-migrate down --dir=src/db/migrations --file-extension ts --tsconfig tsconfig.json",
"start": "node dist/main.js"
},
"dependencies": {
"@types/express": "^5.0.0",
"@types/socket.io": "^3.0.2",
"dotenv": "^16.4.7",
"ethers": "^6.13.5",
"express": "^4.21.2",
"node-pg-migrate": "^7.9.0",
"pg": "^8.13.1",
"socket.io": "^4.8.1",
"ts-node": "^10.9.2",
"typescript": "^5.7.3",
"winston": "^3.17.0"
},
"devDependencies": {
"@types/dotenv": "^8.2.3",
"@types/node": "^22.10.7",
"@types/pg": "^8.11.10",
"nodemon": "^3.1.9"
}
}

//tsconfig.json
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": ["src"]
}

Any ideas would be appreciated - Thank you!

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

2 Replies

cflattumPRO

3 months ago

I ended up specifying the node engine in my package.json which fixed this error.

Solved.

  "engines": {
    "node": "22"
  },

3 months ago

Thank you for raising, and for providing the solution!


Status changed to Awaiting User Response railway[bot] 3 months ago


Status changed to Solved christian 3 months ago


Solved: Error on Yarn Install in Docker - Railway Help Station