R
Railway2y ago
Sakin

Resolve npm dependency error in production

I'm getting this error after deploying. I've added buildScript = "npm install --legacy-peer-deps" inside railway.toml file but it's not working.
ERR! code ERESOLVE
#11 1.981 npm ERR! ERESOLVE unable to resolve dependency tree
#11 1.981 npm ERR!
#11 1.982 npm ERR! While resolving: [email protected]
#11 1.982 npm ERR! Found: [email protected]
#11 1.982 npm ERR! node_modules/axios
#11 1.982 npm ERR! axios@"^1.3.4" from the root project
#11 1.982 npm ERR!
#11 1.982 npm ERR! Could not resolve dependency:
#11 1.982 npm ERR! peer axios@"^0.27.2" from [email protected]
#11 1.982 npm ERR! node_modules/soap
#11 1.982 npm ERR! soap@"^1.0.0" from the root project
#11 1.982 npm ERR!
#11 1.982 npm ERR! Fix the upstream dependency conflict, or retry
#11 1.982 npm ERR! this command with --force, or --legacy-peer-deps
#11 1.982 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#11 1.982 npm ERR!
#11 1.982 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#11 1.984
#11 1.984 npm ERR! A complete log of this run can be found in:
#11 1.984 npm ERR! /root/.npm/_logs/2023-04-26T03_57_29_004Z-debug-0.log
#11 ERROR: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1
-----
> [stage-0 7/8] RUN --mount=type=cache,id=s/c85c814f-f191-4ef1-8291-2368d5f11010-/root/npm,target=/root/.npm npm i:
#11 1.982 npm ERR! soap@"^1.0.0" from the root project
#11 1.982 npm ERR!
#11 1.982 npm ERR! Fix the upstream dependency conflict, or retry
#11 1.982 npm ERR! this command with --force, or --legacy-peer-deps
#11 1.982 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#11 1.982 npm ERR!
#11 1.982 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#11 1.984
#11 1.984 npm ERR! A complete log of this run can be found in:

#11 1.984 npm ERR! /root/.npm/_logs/2023-04-26T03_57_29_004Z-debug-0.log
-----
Dockerfile:21
-------------------
...
ERR! code ERESOLVE
#11 1.981 npm ERR! ERESOLVE unable to resolve dependency tree
#11 1.981 npm ERR!
#11 1.982 npm ERR! While resolving: [email protected]
#11 1.982 npm ERR! Found: [email protected]
#11 1.982 npm ERR! node_modules/axios
#11 1.982 npm ERR! axios@"^1.3.4" from the root project
#11 1.982 npm ERR!
#11 1.982 npm ERR! Could not resolve dependency:
#11 1.982 npm ERR! peer axios@"^0.27.2" from [email protected]
#11 1.982 npm ERR! node_modules/soap
#11 1.982 npm ERR! soap@"^1.0.0" from the root project
#11 1.982 npm ERR!
#11 1.982 npm ERR! Fix the upstream dependency conflict, or retry
#11 1.982 npm ERR! this command with --force, or --legacy-peer-deps
#11 1.982 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#11 1.982 npm ERR!
#11 1.982 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#11 1.984
#11 1.984 npm ERR! A complete log of this run can be found in:
#11 1.984 npm ERR! /root/.npm/_logs/2023-04-26T03_57_29_004Z-debug-0.log
#11 ERROR: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1
-----
> [stage-0 7/8] RUN --mount=type=cache,id=s/c85c814f-f191-4ef1-8291-2368d5f11010-/root/npm,target=/root/.npm npm i:
#11 1.982 npm ERR! soap@"^1.0.0" from the root project
#11 1.982 npm ERR!
#11 1.982 npm ERR! Fix the upstream dependency conflict, or retry
#11 1.982 npm ERR! this command with --force, or --legacy-peer-deps
#11 1.982 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#11 1.982 npm ERR!
#11 1.982 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#11 1.984
#11 1.984 npm ERR! A complete log of this run can be found in:

#11 1.984 npm ERR! /root/.npm/_logs/2023-04-26T03_57_29_004Z-debug-0.log
-----
Dockerfile:21
-------------------
...
13 Replies
Percy
Percy2y ago
Project ID: c85c814f-f191-4ef1-8291-2368d5f11010
alex
alex2y ago
update your deps and use pnpm or yarn why do you need version locked dependencies
Brody
Brody2y ago
please send your full railway.toml file?
alex
alex2y ago
that too
Brody
Brody2y ago
but yeah what alex said would be the proper solution
alex
alex2y ago
yeah using legacy peer deps or forcing dependencies to install is never a good idea
Sakin
SakinOP2y ago
builder = "NIXPACKS"
buildScript = "npm install --legacy-peer-deps"

[deploy]
startCommand = "npm start"
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10
builder = "NIXPACKS"
buildScript = "npm install --legacy-peer-deps"

[deploy]
startCommand = "npm start"
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10
if I change the version I'll have to change the code in multiple places
alex
alex2y ago
... you should do that then <:bruh_moment:669042568356429844>
Sakin
SakinOP2y ago
I know it's not a good practice but somehow I need that
alex
alex2y ago
Brody
Brody2y ago
fine its BuildCommand not buildScript
Sakin
SakinOP2y ago
updated, not working @Brody
Brody
Brody2y ago
then I'm gonna have to recommend you go with Alex's solution
Want results from more Discord servers?
Add your server