[error] Cannot find module @rollup/rollup-linux-x64-gnu

Hello,

I’ve restarted working on a Nuxt 3 project after some months and started getting this build error. I’ve already followed the instructions to this post to no avail. In addition, the project builds on my Windows PC so I’m not quite sure what’s happening here. I’ve posted my build logs and package.json below

package.json

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev --host",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@pinia/nuxt": "^0.7.0",
    "@quasar/extras": "^1.16.11",
    "firebase": "^11.0.2",
    "nuxt": "^3.11.2",
    "nuxt-quasar-ui": "^2.1.2",
    "pinia": "^2.1.7",
    "quasar": "^2.16.4",
    "slug": "^10.0.0",
    "v-viewer": "^3.0.20",
    "viewerjs": "^1.11.6",
    "vue": "^3.4.21",
    "vue-router": "^4.3.0"
  },
  "devDependencies": {
    "@types/slug": "^5.0.9"
  },
  "resolutions": {
    "rollup": "npm:@rollup/wasm-node"
  },
  "optionalDependencies": {
    "@rollup/rollup-linux-x64-gnu": "4.27.3"
  }
}

3:24:57 AM: build-image version: 1102982490d25c0b1867ab7efadd5284871d7e00 (focal)
3:24:57 AM: buildbot version: 1102982490d25c0b1867ab7efadd5284871d7e00
3:24:57 AM: Building without cache
3:24:57 AM: Starting to prepare the repo for build
3:24:57 AM: No cached dependencies found. Cloning fresh repo
3:24:57 AM: git clone --filter=blob:none https://github.com/simeon9696/jeremy-ali
3:24:58 AM: Preparing Git Reference refs/heads/backend
3:24:59 AM: Custom publish path detected. Proceeding with the specified path: '.output/public'
3:24:59 AM: Custom build command detected. Proceeding with the specified command: 'npm run generate'
3:25:00 AM: Starting to install dependencies
3:25:01 AM: mise python@3.8.20   installing
3:25:01 AM: mise python@3.8.20   downloading cpython-3.8.20+20241002-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
3:25:01 AM: mise python@3.8.20   installing cpython-3.8.20+20241002-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
3:25:02 AM: mise python@3.8.20   python --version
3:25:02 AM: mise python@3.8.20   Python 3.8.20
3:25:02 AM: mise python@3.8.20 ✓ installed
3:25:02 AM: Python version set to 3.8
3:25:03 AM: Collecting pipenv
3:25:03 AM:   Downloading pipenv-2024.4.0-py3-none-any.whl.metadata (19 kB)
3:25:03 AM: Collecting certifi (from pipenv)
3:25:03 AM:   Downloading certifi-2024.8.30-py3-none-any.whl.metadata (2.2 kB)
3:25:03 AM: Collecting packaging>=22 (from pipenv)
3:25:03 AM:   Downloading packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
3:25:03 AM: Requirement already satisfied: setuptools>=67 in /opt/buildhome/.local/share/mise/installs/python/3.8.20/lib/python3.8/site-packages (from pipenv) (70.3.0)
3:25:03 AM: Collecting virtualenv>=20.24.2 (from pipenv)
3:25:03 AM:   Downloading virtualenv-20.27.1-py3-none-any.whl.metadata (4.5 kB)
3:25:03 AM: Collecting distlib<1,>=0.3.7 (from virtualenv>=20.24.2->pipenv)
3:25:03 AM:   Downloading distlib-0.3.9-py2.py3-none-any.whl.metadata (5.2 kB)
3:25:03 AM: Collecting filelock<4,>=3.12.2 (from virtualenv>=20.24.2->pipenv)
3:25:03 AM:   Downloading filelock-3.16.1-py3-none-any.whl.metadata (2.9 kB)
3:25:03 AM: Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.24.2->pipenv)
3:25:03 AM:   Downloading platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB)
3:25:03 AM: Downloading pipenv-2024.4.0-py3-none-any.whl (3.0 MB)
3:25:03 AM:    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 35.5 MB/s eta 0:00:00
3:25:03 AM: Downloading packaging-24.2-py3-none-any.whl (65 kB)
3:25:03 AM:    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 5.0 MB/s eta 0:00:00
3:25:03 AM: Downloading virtualenv-20.27.1-py3-none-any.whl (3.1 MB)
3:25:03 AM:    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 157.6 MB/s eta 0:00:00
3:25:03 AM: Downloading certifi-2024.8.30-py3-none-any.whl (167 kB)
3:25:03 AM:    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 167.3/167.3 kB 24.9 MB/s eta 0:00:00
3:25:03 AM: Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
3:25:03 AM:    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 kB 55.7 MB/s eta 0:00:00
3:25:03 AM: Downloading filelock-3.16.1-py3-none-any.whl (16 kB)
3:25:03 AM: Downloading platformdirs-4.3.6-py3-none-any.whl (18 kB)
3:25:03 AM: Installing collected packages: distlib, platformdirs, packaging, filelock, certifi, virtualenv, pipenv
3:25:05 AM: Successfully installed certifi-2024.8.30 distlib-0.3.9 filelock-3.16.1 packaging-24.2 pipenv-2024.4.0 platformdirs-4.3.6 virtualenv-20.27.1
3:25:05 AM: [notice] A new release of pip is available: 24.1.2 -> 24.3.1
3:25:05 AM: [notice] To update, run: pip install --upgrade pip
3:25:05 AM: Attempting Ruby version 2.7.2, read from environment
3:25:06 AM: Using Ruby version 2.7.2
3:25:06 AM: Started restoring cached go cache
3:25:06 AM: Finished restoring cached go cache
3:25:06 AM: go version go1.19.13 linux/amd64
3:25:07 AM: Using PHP version 8.0
3:25:09 AM: Downloading and installing node v20.18.1...
3:25:09 AM: Downloading https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz...
3:25:10 AM: Computing checksum with sha256sum
3:25:10 AM: Checksums matched!
3:25:12 AM: Now using node v20.18.1 (npm v10.8.2)
3:25:12 AM: Enabling Node.js Corepack
3:25:12 AM: Started restoring cached build plugins
3:25:12 AM: Finished restoring cached build plugins
3:25:12 AM: Started restoring cached corepack dependencies
3:25:12 AM: Finished restoring cached corepack dependencies
3:25:12 AM: No npm workspaces detected
3:25:12 AM: Started restoring cached node modules
3:25:12 AM: Finished restoring cached node modules
3:25:12 AM: Installing npm packages using npm version 10.8.2
3:25:12 AM: npm warn config optional Use `--omit=optional` to exclude optional dependencies, or
3:25:12 AM: npm warn config `--include=optional` to include them.
3:25:12 AM: npm warn config
3:25:12 AM: npm warn config       Default value does install optional deps unless otherwise omitted.
3:25:13 AM: npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
3:25:13 AM: npm warn deprecated npmlog@5.0.1: This package is no longer supported.
3:25:14 AM: npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
3:25:14 AM: npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.
3:25:14 AM: npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
3:25:14 AM: npm warn deprecated gauge@3.0.2: This package is no longer supported.
3:25:21 AM: Failed during stage 'Install dependencies': dependency_installation script returned non-zero exit code: 1
3:25:20 AM: > postinstall
3:25:20 AM: > nuxt prepare
3:25:21 AM: [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.
3:25:21 AM:   at requireWithFriendlyError (node_modules/rollup/dist/native.js:63:9)
3:25:21 AM:   at Object.<anonymous> (node_modules/rollup/dist/native.js:72:76)
3:25:21 AM:   at Module._compile (node:internal/modules/cjs/loader:1469:14)
3:25:21 AM:   at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
3:25:21 AM:   at Module.load (node:internal/modules/cjs/loader:1288:32)
3:25:21 AM:   at Module._load (node:internal/modules/cjs/loader:1104:12)
3:25:21 AM:   at cjsLoader (node:internal/modules/esm/translators:346:17)
3:25:21 AM:   at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:286:7)
3:25:21 AM:   at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
3:25:21 AM:   at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
3:25:21 AM: [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.
3:25:21 AM: npm error code 1
3:25:21 AM: npm error path /opt/build/repo
3:25:21 AM: npm error command failed
3:25:21 AM: npm error command sh -c nuxt prepare
3:25:21 AM: npm error A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-11-22T07_25_12_538Z-debug-0.log
3:25:21 AM: Error during npm install
3:25:21 AM: Failing build: Failed to install dependencies
3:25:21 AM: Finished processing build request in 24.197s```

Please help, I really need to get this build off the ground

what is the name of the site?

Hello, thanks for reaching out - https://crafttedfoods.com
Site ID - ac93e490-fcce-44e2-adc6-aa3eafd00eaf

I can’t remember why but I had this in my netlify.toml file

[build.environment]
  CI = "1"
  NPM_FLAGS = "--no-optional"

Removing it allowed the build to succeed

1 Like