R
Railway17mo ago
claudiu

Next JS build failed

Hello, is first time when I'm trying railway.app and I'm trying to deploy a repo which is structured like this github/repo /client /server client is a next.js project server is a nest.js project I'm using pnpm for builds for both of them but the client failed with this error
#3 [internal] load metadata for
...

#12 [stage-0 8/10] RUN --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-next/cache,target=/app/.next/cache --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-node_modules/cache,target=/app/node_modules/.cache pnpm build

#12 0.485 /bin/bash: line 1: pnpm: command not found
#12 ERROR: process "/bin/bash -ol pipefail -c pnpm build" did not complete successfully: exit code: 127

-----
> [stage-0 8/10] RUN --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-next/cache,target=/app/.next/cache --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-node_modules/cache,target=/app/node_modules/.cache pnpm build:
#12 0.485 /bin/bash: line 1: pnpm: command not found
-----

Dockerfile:24
-------------------
22 | # build phase
23 | COPY . /app/.
24 | >>> RUN --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-next/cache,target=/app/.next/cache --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-node_modules/cache,target=/app/node_modules/.cache pnpm build

25 |
26 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm build" did not complete successfully: exit code: 127

Error: Docker build failed
#3 [internal] load metadata for
...

#12 [stage-0 8/10] RUN --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-next/cache,target=/app/.next/cache --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-node_modules/cache,target=/app/node_modules/.cache pnpm build

#12 0.485 /bin/bash: line 1: pnpm: command not found
#12 ERROR: process "/bin/bash -ol pipefail -c pnpm build" did not complete successfully: exit code: 127

-----
> [stage-0 8/10] RUN --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-next/cache,target=/app/.next/cache --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-node_modules/cache,target=/app/node_modules/.cache pnpm build:
#12 0.485 /bin/bash: line 1: pnpm: command not found
-----

Dockerfile:24
-------------------
22 | # build phase
23 | COPY . /app/.
24 | >>> RUN --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-next/cache,target=/app/.next/cache --mount=type=cache,id=s/00442537-a0d8-4cd5-bfd3-4dc268643cd0-node_modules/cache,target=/app/node_modules/.cache pnpm build

25 |
26 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm build" did not complete successfully: exit code: 127

Error: Docker build failed
`
Solution:
I've found the problem when the project was created a package-lock.json was created, I removed that, I run pnpm installwhich created pnpm-lock.json and now everything is working fine
Jump to solution
2 Replies
Percy
Percy17mo ago
Project ID: 00442537-a0d8-4cd5-bfd3-4dc268643cd0,00442537-a0d8-4cd5-bfd3-4dc268643cd0,00442537-a0d8-4cd5-bfd3-4dc268643cd0,00442537-a0d8-4cd5-bfd3-4dc268643cd0,00442537-a0d8-4cd5-bfd3-4dc268643cd0,00442537-a0d8-4cd5-bfd3-4dc268643cd0
Solution
claudiu
claudiu17mo ago
I've found the problem when the project was created a package-lock.json was created, I removed that, I run pnpm installwhich created pnpm-lock.json and now everything is working fine
Want results from more Discord servers?
Add your server