Hello - I have a Nuxt2 site which hasn’t been updated in a few years, previously building/deploying fine. It’s now throwing the error: Command failed with exit code 1: npm run generate
- Site name: sharasymowicz.com
I can’t get it to build locally either since moving to a new mac. The cloned repo gives npm install errors relating (it appears) to node-gyp. Here’s some relevant local machine dets:
- Mac OS 15.5
- node 22.20.0 (lts) - also have v16.20.2 via nvm
- npm 10.9.3
- node-gyp: 11.4.2
- Python3
Local npm install error messages report using node-gyp@7.1.2
Have tried forcing the globally installed node-gyp version 11.4.2 but no joy.
Tried npm installs using node v16.20.2 but got the same errors.
Haven’t pushed any npm-related commits to the Git repo over the last few years so I’m guessing the Netlify build hasn’t been affected by the repo. Are my local build and the Netlify errors related to Nuxt2?
Content editor issue
As an aside, the affected website has an issue where one of the public-facing pages and its related content editor folder are out of sync. There’s no content at all in the editor for that page and I’m not able to generate a new document there. I’d like to generate new content in the editor to bypass the build issue but can’t.
Here’s a dump of the Netlify build:
1:51:33 PM: Netlify Build
1:51:33 PM: ────────────────────────────────────────────────────────────────
1:51:33 PM:
1:51:33 PM: ❯ Version
1:51:33 PM: @netlify/build 35.1.8
1:51:33 PM:
1:51:33 PM: ❯ Flags
1:51:33 PM: accountId: 5b99731d67610c194243a7fd
1:51:33 PM: baseRelDir: true
1:51:33 PM: buildId: 68e1180580a68e1e35876030
1:51:33 PM: deployId: 68e1180580a68e1e35876032
1:51:33 PM:
1:51:33 PM: ❯ Current directory
1:51:33 PM: /opt/build/repo
1:51:33 PM:
1:51:33 PM: ❯ Config file
1:51:33 PM: /opt/build/repo/netlify.toml
1:51:33 PM:
1:51:33 PM: ❯ Context
1:51:33 PM: production
1:51:33 PM:
1:51:33 PM: Build command from Netlify app
1:51:33 PM: ────────────────────────────────────────────────────────────────
1:51:33 PM:
1:51:33 PM: $ npm run generate
1:51:33 PM: > s-harasymowicz@1.0.0 generate /opt/build/repo
1:51:33 PM: > nuxt generate
1:51:33 PM: /opt/build/repo/node_modules/ufo/dist/index.cjs:347
1:51:33 PM: if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
1:51:33 PM: ^
1:51:33 PM: SyntaxError: Unexpected token '.'
1:51:33 PM: at wrapSafe (internal/modules/cjs/loader.js:1054:16)
1:51:33 PM: at Module._compile (internal/modules/cjs/loader.js:1102:27)
1:51:33 PM: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
1:51:33 PM: at Module.load (internal/modules/cjs/loader.js:986:32)
1:51:33 PM: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
1:51:33 PM: at Module.require (internal/modules/cjs/loader.js:1026:19)
1:51:33 PM: at require (internal/modules/cjs/helpers.js:72:18)
1:51:33 PM: at Object.<anonymous> (/opt/build/repo/node_modules/@nuxt/utils/dist/utils.js:9:13)
1:51:33 PM: at Module._compile (internal/modules/cjs/loader.js:1138:30)
1:51:33 PM: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
1:51:33 PM: npm ERR! code ELIFECYCLE
1:51:33 PM: npm ERR! errno 1
1:51:33 PM: npm ERR! s-harasymowicz@1.0.0 generate: `nuxt generate`
1:51:33 PM: npm ERR! Exit status 1
1:51:33 PM: npm ERR!
1:51:33 PM: npm ERR! Failed at the s-harasymowicz@1.0.0 generate script.
1:51:33 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:51:33 PM: npm ERR! A complete log of this run can be found in:
1:51:33 PM: npm ERR! /opt/buildhome/.npm/_logs/2025-10-04T12_51_33_837Z-debug.log
1:51:33 PM:
1:51:33 PM: "build.command" failed
1:51:33 PM: ────────────────────────────────────────────────────────────────
1:51:33 PM:
1:51:33 PM: Error message
1:51:33 PM: Command failed with exit code 1: npm run generate (https://ntl.fyi/exit-code-1)
1:51:33 PM:
1:51:33 PM: Error location
1:51:33 PM: In Build command from Netlify app:
1:51:33 PM: npm run generate
1:51:33 PM:
1:51:33 PM: Resolved config
1:51:33 PM: build:
1:51:33 PM: command: npm run generate
1:51:33 PM: commandOrigin: ui
1:51:33 PM: environment:
1:51:33 PM: - CLOUDINARY_CLOUD_NAME
1:51:33 PM: - CLOUDINARY_URL
1:51:33 PM: - GOOGLE_ANALYTICS_ID
1:51:33 PM: - NETLIFY_BASE_URL_DEV
1:51:33 PM: - NETLIFY_BASE_URL_PRODUCTION
1:51:33 PM: - NETLIFY_LFS_ORIGIN_URL
1:51:33 PM: publish: /opt/build/repo/dist
1:51:33 PM: publishOrigin: ui
1:51:33 PM: headers:
1:51:33 PM: - for: sdhp-preview.netlify.app
1:51:33 PM: values:
1:51:33 PM: X-Frame-Options: DENY
1:51:33 PM: X-Robots-Tag: noindex
1:51:33 PM: X-XSS-Protection: 1; mode=block
1:51:34 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:51:34 PM: - for: sdhp-preview.netlify.app/*
values:
X-Frame-Options: DENY
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block
- for: /sdhp-preview.netlify.app/*
values:
X-Frame-Options: DENY
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block
- for: develop--sdhp-preview.netlify.app
values:
X-Frame-Options: DENY
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block
- for: /develop--sdhp-preview.netlify.app
values:
X-Frame-Options: DENY
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block
- for: develop--sdhp-preview.netlify.app/*
values:
X-Frame-Options: DENY
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block
- for: /develop--sdhp-preview.netlify.app/*
values:
X-Frame-Options: DENY
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block
headersOrigin: config
1:51:34 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:51:34 PM: Failing build: Failed to build site
1:51:34 PM: Finished processing build request in 42.436s
Local build npm errors:
npm error code 127
npm error path /Users/theUser/Sites/theSite/node_modules/fibers
npm error command failed
npm error command sh -c node build.js || nodejs build.js
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@7.1.2
npm error gyp info using node@22.20.0 | darwin | arm64
npm error (node:92701) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
npm error gyp ERR! UNCAUGHT EXCEPTION
npm error gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>'
npm error gyp ERR! stack at createConfigFile (/Users/theUser/Sites/theSite/node_modules/node-gyp/lib/configure.js:117:21)
npm error gyp ERR! stack at /Users/theUser/Sites/theSite/node_modules/node-gyp/lib/configure.js:84:9
npm error gyp ERR! stack at FSReqCallback.oncomplete (node:fs:187:23)
npm error gyp ERR! System Darwin 24.5.0
npm error gyp ERR! command "/Users/theUser/.nvm/versions/node/v22.20.0/bin/node" "/Users/theUser/Sites/theSite/node_modules/.bin/node-gyp" "rebuild" "--release"
npm error gyp ERR! cwd /Users/theUser/Sites/theSite/node_modules/fibers
npm error gyp ERR! node -v v22.20.0
npm error gyp ERR! node-gyp -v v7.1.2
npm error gyp ERR! Node-gyp failed to build your package.
npm error gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm error node-gyp exited with code: 7
npm error Please make sure you are using a supported platform and node version. If you
npm error would like to compile fibers on this machine please make sure you have setup your
npm error build environment--
npm error Windows + OS X instructions here: https://github.com/nodejs/node-gyp
npm error Ubuntu users please run: `sudo apt-get install g++ build-essential`
npm error RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
npm error Alpine users please run: `sudo apk add python make g++`
npm error sh: nodejs: command not found
Any help/advice would be much appreciated!
Thanks in advance