Home
Support Forums

Deploy failed - Build script returned non-zero exit code: 2

Hello,

I am having trouble getting site: gallant-nightingale-f0716d deployed.

I have tried many of the solutions but none of them seem to work. The build works locally, so the issue is not clear to me. My build log is below. Any help would be appreciated. Thank you.

9:53:33 PM: Build ready to start
9:53:35 PM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
9:53:35 PM: build-image tag: v4.3.0
9:53:35 PM: buildbot version: e99637385725adf30662bad8cf7d70d9f3623653
9:53:35 PM: Building without cache
9:53:35 PM: Starting to prepare the repo for build
9:53:35 PM: No cached dependencies found. Cloning fresh repo
9:53:35 PM: git clone https://github.com/daystone4/personal-portfolio
9:53:36 PM: Preparing Git Reference refs/heads/main
9:53:36 PM: Parsing package.json dependencies
9:53:37 PM: Starting build script
9:53:37 PM: Installing dependencies
9:53:37 PM: Python version set to 2.7
9:53:37 PM: Downloading and installing node v16.9.1…
9:53:38 PM: Downloading https://nodejs.org/dist/v16.9.1/node-v16.9.1-linux-x64.tar.xz…
9:53:38 PM: Computing checksum with sha256sum
9:53:38 PM: Checksums matched!
9:53:41 PM: Now using node v16.9.1 (npm v7.21.1)
9:53:41 PM: Started restoring cached build plugins
9:53:41 PM: Finished restoring cached build plugins
9:53:42 PM: Attempting ruby version 2.7.2, read from environment
9:53:43 PM: Using ruby version 2.7.2
9:53:43 PM: Using PHP version 8.0
9:53:43 PM: Started restoring cached node modules
9:53:43 PM: Finished restoring cached node modules
9:53:44 PM: Installing NPM modules using NPM version 7.21.1
9:53:46 PM: npm WARN old lockfile
9:53:46 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
9:53:46 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
9:53:46 PM: npm WARN old lockfile
9:53:46 PM: npm WARN old lockfile This is a one-time fix-up, please be patient…
9:53:46 PM: npm WARN old lockfile
9:54:06 PM: npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
9:54:06 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
9:54:07 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
9:54:11 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
9:54:17 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
9:54:21 PM: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
9:54:26 PM: added 1300 packages, and audited 1301 packages in 41s
9:54:26 PM: 104 packages are looking for funding
9:54:26 PM: run npm fund for details
9:54:26 PM: 8 moderate severity vulnerabilities
9:54:26 PM: To address issues that do not require attention, run:
9:54:26 PM: npm audit fix
9:54:26 PM: To address all issues (including breaking changes), run:
9:54:26 PM: npm audit fix --force
9:54:26 PM: Run npm audit for details.
9:54:26 PM: NPM modules installed
9:54:26 PM: Started restoring cached go cache
9:54:26 PM: Finished restoring cached go cache
9:54:26 PM: go version go1.16.5 linux/amd64
9:54:26 PM: go version go1.16.5 linux/amd64
9:54:26 PM: Installing missing commands
9:54:26 PM: Verify run directory
9:54:28 PM: ​
9:54:28 PM: ────────────────────────────────────────────────────────────────
9:54:28 PM: Netlify Build
9:54:28 PM: ────────────────────────────────────────────────────────────────
9:54:28 PM: ​
9:54:28 PM: ❯ Version
9:54:28 PM: @netlify/build 18.10.0
9:54:28 PM: ​
9:54:28 PM: ❯ Flags
9:54:28 PM: baseRelDir: true
9:54:28 PM: buildId: 6142a39d5bc11374fbf9dc1e
9:54:28 PM: deployId: 6142a39d5bc11374fbf9dc20
9:54:28 PM: ​
9:54:28 PM: ❯ Current directory
9:54:28 PM: /opt/build/repo
9:54:28 PM: ​
9:54:28 PM: ❯ Config file
9:54:28 PM: No config file was defined: using default values.
9:54:28 PM: ​
9:54:28 PM: ❯ Context
9:54:28 PM: production
9:54:28 PM: ​
9:54:28 PM: ────────────────────────────────────────────────────────────────
9:54:28 PM: 1. Build command from Netlify app
9:54:28 PM: ────────────────────────────────────────────────────────────────
9:54:28 PM: ​
9:54:28 PM: $ CI= npm run generate
9:54:28 PM: > david-portfolio@1.0.0 generate
9:54:28 PM: > nuxt generate
9:54:38 PM: node: …/src/coroutine.cc:134: void* find_thread_id_key(void*): Assertion `thread_id_key != 0x7777’ failed.Aborted
9:54:38 PM: ​
9:54:38 PM: ────────────────────────────────────────────────────────────────
9:54:38 PM: β€œbuild.command” failed
9:54:38 PM: ────────────────────────────────────────────────────────────────
9:54:38 PM: ​
9:54:38 PM: Error message
9:54:38 PM: Command failed with exit code 134: CI= npm run generate
9:54:38 PM: ​
9:54:38 PM: Error location
9:54:38 PM: In Build command from Netlify app:
9:54:38 PM: CI= npm run generate
9:54:38 PM: ​
9:54:38 PM: Resolved config
9:54:38 PM: build:
9:54:38 PM: command: CI= npm run generate
9:54:38 PM: commandOrigin: ui
9:54:38 PM: publish: /opt/build/repo/dist
9:54:38 PM: publishOrigin: ui
9:54:38 PM: Caching artifacts
9:54:38 PM: Started saving node modules
9:54:38 PM: Finished saving node modules
9:54:38 PM: Started saving build plugins
9:54:38 PM: Finished saving build plugins
9:54:38 PM: Started saving pip cache
9:54:38 PM: Finished saving pip cache
9:54:38 PM: Started saving emacs cask dependencies
9:54:38 PM: Finished saving emacs cask dependencies
9:54:38 PM: Started saving maven dependencies
9:54:38 PM: Finished saving maven dependencies
9:54:38 PM: Started saving boot dependencies
9:54:38 PM: Finished saving boot dependencies
9:54:38 PM: Started saving rust rustup cache
9:54:38 PM: Finished saving rust rustup cache
9:54:38 PM: Started saving go dependencies
9:54:38 PM: Finished saving go dependencies
9:54:41 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:54:41 PM: Creating deploy upload records
9:54:41 PM: Failing build: Failed to build site
9:54:41 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
9:54:41 PM: Finished processing build request in 1m6.395759524s

Hi, @daystone4. It looks like the error itself is here:

9:54:38 PM: node: …/src/coroutine.cc:134: void* find_thread_id_key(void*): Assertion `thread_id_key != 0x7777’ failed.Aborted

The first thing I could check is if the node version you are using locally matches the node version the build system used. If they don’t match, then setting the node version at Netlify (and there are many ways to do this) would be the solution. The various ways to see a node version can be found here:

Personally, if it were me I would at a file named netlify.toml to the base of the repo and put this in it

[build.environment]
  NODE_VERSION="14.0.0"

I did test building your site with node version 14.0.0 and it was successful. Please set that to whatever version you use locally and keep the version in netlify.toml in sync and your builds should be the same locally and at Netlify. (In other words, don’t use 14.0.0 unless that is actually what your local development system is using too.)

That netlify.toml method is just my opinion though and you may find that using some other method to control the node version works better for you. Again, the documentation above lists several different ways.

If that doesn’t fix it or if there are other questions, please reply anytime.

Thank you! Adding the netlify.toml file worked. I’ll take a look at the docs as well.

2 Likes