build failed

yourloveyou
HOBBY

18 days ago

Hello,

I am having a persistent and critical build error when trying to deploy the frontend of my Node.js monorepo application. The build fails with the following error:

Error: Cannot find module @rollup/rollup-linux-x64-gnu

I have been working with an AI assistant to try to solve this, and we have tried the following solutions, none of which have worked:

  1. Ensured all code changes were committed and pushed to the correct branch (

    my-new-feature

    ).

  2. Verified that the

    package.json on the deployment branch is correct.

  3. Rebuilt the

    package-lock.json

    file from scratch.

  4. Cleared the build cache by deleting and recreating the service.

  5. Updated all of my project's dependencies to their latest versions.

  6. Configured the build with a

    nixpacks.toml file to:

    • Use

      npm install --legacy-peer-deps

      to resolve dependency conflicts.

    • Force a clean install with

      rm -rf node_modules

      .

    • Specify Node.js version 18 and npm version 8.

Despite all of these steps, the build continues to fail with the same Rollup error. The backend service for this project deployed successfully after some initial troubleshooting.

My project ID is: [visualbookshelf]

This is a blocking issue for me, and I have exhausted all possible solutions. Please investigate this issue on your end as soon as possible.

Thank you for your help.

$10 Bounty

4 Replies

Railway
BOT

18 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


18 days ago

Well, this would be it: Error: Cannot find module @rollup/rollup-linux-x64-gnu

Can you get the full build logs for us?


Status changed to Awaiting User Response Railway 18 days ago


yourloveyou
HOBBY

18 days ago

the following are build logs To address all issues (including breaking changes), run: npm audit fix --force Run npm audit for details.

[stage-0 8/12] RUN --mount=type=cache,id=s/c5d4eab1-fd65-46c2-acfd-f2ae4997055a-/root/npm,target=/root/.npm npm install --legacy-peer-deps 25 sec

[stage-0 9/12] COPY . /app/.

[stage-0 9/12] COPY . /app/. 393 ms

[stage-0 10/12] RUN --mount=type=cache,id=s/c5d4eab1-fd65-46c2-acfd-f2ae4997055a-node_modules/cache,target=/app/node_modules/.cache npm run build:client

npm warn config production Use --omit=dev instead.

> rest-express@1.0.0 build:client > vite build

/app/node_modules/rollup/dist/native.js:64 throw new Error( ^ Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory. at requireWithFriendlyError (/app/node_modules/rollup/dist/native.js:64:9) at Object.<anonymous> (/app/node_modules/rollup/dist/native.js:73:76) ... 3 lines matching cause stack trace ... at Module._load (node:internal/modules/cjs/loader:1019:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29) at ModuleJob.run (node:internal/modules/esm/module_job:195:25) at async ModuleLoader.import (node:internal/modules/esm/loader:337:24) { [cause]: Error: Cannot find module '@rollup/rollup-linux-x64-gnu' Require stack: - /app/node_modules/rollup/dist/native.js at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15) at Module._load (node:internal/modules/cjs/loader:981:27) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireWithFriendlyError (/app/node_modules/rollup/dist/native.js:46:10) at Object.<anonymous> (/app/node_modules/rollup/dist/native.js:73:76) at Module._compile (node:internal/modules/cjs/loader:1364:14) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/app/node_modules/rollup/dist/native.js' ] } } Node.js v18.20.5

✕ [stage-0 10/12] RUN --mount=type=cache,id=s/c5d4eab1-fd65-46c2-acfd-f2ae4997055a-node_modules/cache,target=/app/node_modules/.cache npm run build:client

process "/bin/bash -ol pipefail -c npm run build:client" did not complete successfully: exit code: 1

Dockerfile:25

-------------------

23 | # build phase

24 | COPY . /app/.

25 | >>> RUN --mount=type=cache,id=s/c5d4eab1-fd65-46c2-acfd-f2ae4997055a-node_modules/cache,target=/app/node_modules/.cache npm run build:client

26 |

27 |

-------------------

ERROR: failed to build: failed to solve: process "/bin/bash -ol pipefail -c npm run build:client" did not complete successfully: exit code: 1

Error: Docker build failed


Status changed to Awaiting Railway Response Railway 18 days ago


18 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 18 days ago


mjablonski
PRO

18 days ago

npm has a bug which doesn't install optional dependencies which are required for running a project properly on different cpu architectures.

Can you try to delete node_modules and package-lock.json in your project, run "npm install" and check in the newly created package-lock.json to git?


build failed - Railway Help Station