Build is not working and I don't know why

I’m struggling to build my portfolio: evenguyen.netlify.app

I already set the build command to CI=‘’ npm run build, I updated all the packages (I think) so I’m not sure what’s the problem. The error messages aren’t any help either

10:39:36 PM: npm ERR! | ^
10:39:36 PM: npm ERR! /opt/buildhome/.node-gyp/16.17.0/include/node/node.h:893:3: note: in expansion of macro ‘NODE_MODULE_X’
10:39:36 PM: npm ERR! 893 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
10:39:36 PM: npm ERR! | ^~~~~~~~~~~~~
10:39:36 PM: npm ERR! …/src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
10:39:36 PM: npm ERR! 358 | NODE_MODULE(binding, RegisterModule);
10:39:36 PM: npm ERR! | ^~~~~~~~~~~
10:39:36 PM: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
10:39:36 PM: npm ERR! gyp ERR! build error
10:39:36 PM: npm ERR! gyp ERR! stack Error: make failed with exit code: 2
10:39:36 PM: npm ERR! gyp ERR! stack at ChildProcess.onExit (/opt/build/repo/node_modules/node-gyp/lib/build.js:262:23)
10:39:36 PM: npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
10:39:36 PM: npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
10:39:36 PM: npm ERR! gyp ERR! System Linux 5.4.196-108.356.amzn2.x86_64
10:39:36 PM: npm ERR! gyp ERR! command “/opt/buildhome/.nvm/versions/node/v16.17.0/bin/node” “/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
10:39:36 PM: npm ERR! gyp ERR! cwd /opt/build/repo/node_modules/node-sass
10:39:36 PM: npm ERR! gyp ERR! node -v v16.17.0
10:39:36 PM: npm ERR! gyp ERR! node-gyp -v v3.8.0
10:39:36 PM: npm ERR! gyp ERR! not ok
10:39:36 PM: npm ERR! Build failed with error code: 1
10:39:36 PM: npm ERR! A complete log of this run can be found in:
10:39:36 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-09-03T05_37_01_447Z-debug-0.log
10:39:36 PM: Error during NPM install
10:39:36 PM: Build was terminated: Build script returned non-zero exit code: 1
10:39:36 PM: Creating deploy upload reds
10:39:36 PM: Failing build: Failed to build site
10:39:36 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
10:39:36 PM: Finished processing build request in 2m42.215455381s

what’s the issue?

Hi @ENguyen25

Can you share the contents of your package.json, or the repository you are deploying from?

11:12:11 PM: Build ready to start

11:12:14 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)

11:12:14 PM: build-image tag: v4.10.1

11:12:14 PM: buildbot version: 67e75f1ba713a8213d4b5a8ccf9708af751e2390

11:12:14 PM: Fetching cached dependencies

11:12:14 PM: Starting to download cache of 198.6MB

11:12:16 PM: Finished downloading cache in 1.292485264s

11:12:16 PM: Starting to extract cache

11:12:18 PM: Finished extracting cache in 2.733337209s

11:12:18 PM: Finished fetching cache in 4.092300997s

11:12:18 PM: Starting to prepare the repo for build

11:12:19 PM: Preparing Git Reference refs/heads/master

11:12:19 PM: Parsing package.json dependencies

11:12:20 PM: Starting build script

11:12:20 PM: Installing dependencies

11:12:20 PM: Python version set to 2.7

11:12:20 PM: Started restoring cached node version

11:12:21 PM: Finished restoring cached node version

11:12:21 PM: Downloading and installing node v16.17.0...

11:12:21 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...

11:12:22 PM: Computing checksum with sha256sum

11:12:22 PM: Checksums matched!

11:12:24 PM: Now using node v16.17.0 (npm v8.15.0)

11:12:24 PM: Started restoring cached build plugins

11:12:24 PM: Finished restoring cached build plugins

11:12:24 PM: Attempting ruby version 2.7.2, read from environment

11:12:25 PM: Using ruby version 2.7.2

11:12:25 PM: Using PHP version 8.0

11:12:25 PM: No npm workspaces detected

11:12:25 PM: Started restoring cached node modules

11:12:25 PM: Finished restoring cached node modules

11:12:25 PM: Installing NPM modules using NPM version 8.15.0

11:12:26 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

11:12:26 PM: npm WARN config location in the cache, and they are managed by

11:12:26 PM: npm WARN config [`cacache`](http://npm.im/cacache).

11:12:26 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

11:12:26 PM: npm WARN config location in the cache, and they are managed by

11:12:26 PM: npm WARN config [`cacache`](http://npm.im/cacache).

11:12:30 PM: npm ERR! code ERESOLVE

11:12:30 PM: npm ERR! ERESOLVE unable to resolve dependency tree

11:12:30 PM: npm ERR!

11:12:30 PM: npm ERR! While resolving: gatsby-starter-hello-world@0.1.0

11:12:30 PM: npm ERR! Found: gatsby@2.32.13

11:12:30 PM: npm ERR! node_modules/gatsby

11:12:30 PM: npm ERR! gatsby@"^2.23.7" from the root project

11:12:30 PM: npm ERR!

11:12:30 PM: npm ERR! Could not resolve dependency:

11:12:30 PM: npm ERR! peer gatsby@"^4.0.0" from gatsby-plugin-netlify@5.0.1

11:12:30 PM: npm ERR! node_modules/gatsby-plugin-netlify

11:12:30 PM: npm ERR! dev gatsby-plugin-netlify@"^5.0.1" from the root project

11:12:30 PM: npm ERR!

11:12:30 PM: npm ERR! Fix the upstream dependency conflict, or retry

11:12:30 PM: npm ERR! this command with --force, or --legacy-peer-deps

11:12:30 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

11:12:30 PM: npm ERR!

11:12:30 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.

11:12:30 PM: npm ERR! A complete log of this run can be found in:

11:12:30 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-09-03T06_12_26_253Z-debug-0.log

11:12:30 PM: Error during NPM install

11:12:30 PM: Build was terminated: Build script returned non-zero exit code: 1

11:12:30 PM: Creating deploy upload records

11:12:30 PM: Failing build: Failed to build site

11:12:30 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)

11:12:31 PM: Finished processing build request in 16.332789943s

tried again by downloading gatsby-plugin-netlify – it doesn’t like it

The Netlify plugin requires gatsby 4 as per this message:

Your package.json has "gatsby": "^2.23.7" but there is also mention of version 2.32.12

Given you are using gatsby v2 (which is about 2 years old) I suspect it doesn’t like NodeJS v16. You could try adding the --force or --legacy-peer-deps using NPM_FLAGS environment variable, downgrading NodeJS to v14 using the NODE_VERSION environment variable, or updating gatsby (and everything else in the project) to the latest versions. Check out npm outdated.

1 Like

oh thank the Gods. thank you!!!

Great that you got it working @ENguyen25.

Can you say what specifically you did? Downgrade Node, NPM_FLAGS, update packages?

I updated the packages!

1 Like

Thanks for coming back and letting us know! Glad everything is working now. Happy building :rocket: