Nextjs Project Build failed.

jupiterPRO

a year ago

Hello, here is the build log.

10 154.9 gyp ERR! stack Error: make failed with exit code: 2

10 154.9 gyp ERR! stack at ChildProcess. (/nix/store/7g98q0w4ymrfwv6f543l45f71p383pll-nodejs-20.12.2/lib/nodemodules/npm/nodemodules/node-gyp/lib/build.js:209:23)

10 154.9 gyp ERR! System Linux 6.1.0-20-cloud-amd64

10 154.9 gyp ERR! command "/nix/store/7g98q0w4ymrfwv6f543l45f71p383pll-nodejs-20.12.2/bin/node" "/nix/store/7g98q0w4ymrfwv6f543l45f71p383pll-nodejs-20.12.2/lib/nodemodules/npm/nodemodules/node-gyp/bin/node-gyp.js" "rebuild"

10 154.9 gyp ERR! cwd /app/node_modules/usb

10 154.9 gyp ERR! node -v v20.12.2

10 154.9 gyp ERR! node-gyp -v v10.0.1

10 154.9 gyp ERR! not ok

10 154.9 make: Entering directory '/app/node_modules/usb/build'

10 154.9 CC(target) Release/obj.target/libusb/libusb/libusb/core.o

10 154.9 make: Leaving directory '/app/node_modules/usb/build'

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

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

> [stage-0 6/10] RUN --mount=type=cache,id=s/db206de4-fa17-41b1-b675-f6f397b89bb4-/root/cache/Cypress,target=/root/.cache/Cypress --mount=type=cache,id=s/db206de4-fa17-41b1-b675-f6f397b89bb4-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile:

154.9 gyp ERR! System Linux 6.1.0-20-cloud-amd64

154.9 gyp ERR! command "/nix/store/7g98q0w4ymrfwv6f543l45f71p383pll-nodejs-20.12.2/bin/node" "/nix/store/7g98q0w4ymrfwv6f543l45f71p383pll-nodejs-20.12.2/lib/nodemodules/npm/nodemodules/node-gyp/bin/node-gyp.js" "rebuild"

154.9 gyp ERR! cwd /app/node_modules/usb

154.9 gyp ERR! node -v v20.12.2

154.9 gyp ERR! node-gyp -v v10.0.1

154.9 gyp ERR! not ok

154.9 make: Entering directory '/app/node_modules/usb/build'

154.9 CC(target) Release/obj.target/libusb/libusb/libusb/core.o

154.9 make: Leaving directory '/app/node_modules/usb/build'

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

Dockerfile:20

18 | ENV NIXPACKSPATH /app/nodemodules/.bin:$NIXPACKS_PATH

19 | COPY . /app/.

20 | >>> RUN --mount=type=cache,id=s/db206de4-fa17-41b1-b675-f6f397b89bb4-/root/cache/Cypress,target=/root/.cache/Cypress --mount=type=cache,id=s/db206de4-fa17-41b1-b675-f6f397b89bb4-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile

21 |

22 | # build phase

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

Error: Docker build failed

Here i'm also attaching of nixpacks.toml

[phases.setup]
nixPkgs = ['nodejs', 'yarn', 'python3', 'libgcc', 'gnumake', 'libusb']
providers = ['python3']

[phases.build]
cmds = ['yarn build']

[start]
cmd = 'yarn start'

Just fyi, I tried to add " 'libgcc', 'gnumake', 'libusb'" additionally to fix because the build was also failed without them, not sure if this is helpful, thanks!

View Deploy details

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

10 Replies


jupiterPRO

a year ago

Thanks, attached it

Attachments


a year ago

Something is trying to use a USB driver, that's not going to work on Railway no matter how many apt or nix packages you install, please work to remove whatever dependency that requires USB.


jupiterPRO

a year ago

Sorry we're not using the USB driver, anyway, i removed it and sending another log

Attachments


a year ago

Do you have a nixpacks.toml file? if so, please attach it.


jupiterPRO

a year ago

[phases.setup]

nixPkgs = ['nodejs', 'yarn', 'python3']

providers = ['python3']

[phases.build]

cmds = ['yarn build']

[start]

cmd = 'yarn start'


jupiterPRO

a year ago

Please check it


jupiterPRO

a year ago

Hi, just wanted to follow up here.


a year ago

Sorry that this post got lost, my apologies!

This may not be what you want to hear, but I don't think nixpacks is the best fit for you and your app, I think you should move to a Dockerfile based build.


jupiterPRO

a year ago

Hi, thank you, ok, so we reverted it docker based deployment, it looks like its build succeed, but still having the issue.

  1. Docker file here

FROM node:18-alpine

RUN apk add --no-cache libc6-compat git python3 py3-pip make g++ libusb-dev eudev-dev linux-headers

WORKDIR /app

COPY . .

# Fix arm64 timeouts

RUN yarn config set network-timeout 300000 && yarn global add node-gyp

# install deps

RUN yarn install --frozen-lockfile

RUN yarn after-install

ENV NODE_ENV production

# Next.js collects completely anonymous telemetry data about general usage.

# Learn more here: https://nextjs.org/telemetry

# Uncomment the following line in case you want to disable telemetry during the build.

ENV NEXT_TELEMETRY_DISABLED 1

EXPOSE 3000

ENV PORT 3000

CMD ["yarn", "static-serve"]

Attachments


Nextjs Project Build failed. - Railway Help Station