9 months ago
I recently updated yarn on my local machine.
After deploying to git, I recieve an error "yarn command not found" in docker container
I'm not sure how this could happen yarn was working before in my railway instance.
Can someone help?
Error below:
12 [stage-0 8/10] RUN --mount=type=cache,id=s/b19f3ac8-f84d-47bf-9215-801dbb471566-nodemodules/cache,target=/app/nodemodules/.cache yarn && yarn compile
12 0.285 /bin/bash: line 1: yarn: command not found
12 ERROR: process "/bin/bash -ol pipefail -c yarn && yarn compile" did not complete successfully: exit code: 127
[stage-0 8/10] RUN --mount=type=cache,id=s/b19f3ac8-f84d-47bf-9215-801dbb471566-nodemodules/cache,target=/app/nodemodules/.cache yarn && yarn compile:
0.285 /bin/bash: line 1: yarn: command not found
2 warnings found (use --debug to expand):
UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)
LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)
Dockerfile:24
22 | # build phase
23 | COPY . /app/.
24 | >>> RUN --mount=type=cache,id=s/b19f3ac8-f84d-47bf-9215-801dbb471566-nodemodules/cache,target=/app/nodemodules/.cache yarn && yarn compile
25 |
26 |
ERROR: failed to solve: process "/bin/bash -ol pipefail -c yarn && yarn compile" did not complete successfully: exit code: 127
Error: Docker build failed
ⓘ Deployment information is only viewable by project members and Railway employees.
4 Replies
9 months ago
Yarn will be installed as long as you have yarn lock file, if you have any other kind of lock file or no lock file yarn would not be installed.
9 months ago
Thanks!
That seemed to have helped but now I get this:
7.814 error Your lockfile needs to be updated, but yarn was run with --frozen-lockfile
.
I see this in the build logs
╔══════════════ Nixpacks v1.24.0 ═════════════╗
Jul 13 17:27:25
║ setup │ nodejs_18, yarn-1_x ║
Jul 13 17:27:25
║─────────────────────────────────────────────║
Jul 13 17:27:25
║ install │ yarn install --frozen-lockfile ║
Jul 13 17:27:25
║─────────────────────────────────────────────║
Jul 13 17:27:25
║ build │ yarn install && yarn compile ║
Jul 13 17:27:25
║─────────────────────────────────────────────║
Jul 13 17:27:25
║ start │ node build/server.js ║
Jul 13 17:27:25
╚═════════════════════════════════════════════╝
9 months ago
Running yarn install twice is not ideal, it's going to increase your build times.
Your yarn lock files needs to be in sync with the package.json, make sure you are also using yarn 1 locally as that's what is being used on your build.
Status changed to Solved brody • 9 months ago