Gatsby Deploy Failed with non-zero exit code :1

Hi. I’m trying to deploy my Gatsby GraphQL portfolio site and am unable to get it to deploy. It works perfectly in localhost.

Thank you very much!
David

DOMAIN NAME:
practical-dijkstra-746d68.netlify.app

FULL ERROR MESSAGE with Build Log:

8:50:25 AM: Build ready to start
8:50:27 AM: build-image version: a6bb34428a07e7de82f4df5dfe1843fbde91f670 (focal)
8:50:27 AM: build-image tag: v4.5.1
8:50:27 AM: buildbot version: 047dc2001d6cf9f76ba77ae34521e2065ab5c2bd
8:50:28 AM: Fetching cached dependencies
8:50:28 AM: Failed to fetch cache, continuing with build
8:50:28 AM: Starting to prepare the repo for build
8:50:28 AM: No cached dependencies found. Cloning fresh repo
8:50:28 AM: git clone GitHub - Davidkrem/Portfolio-Software-Engineer: David Kremenitzer's Software Engineering Portfolio
8:50:29 AM: Preparing Git Reference refs/heads/main
8:50:29 AM: Parsing package.json dependencies
8:50:30 AM: Starting build script
8:50:30 AM: Installing dependencies
8:50:30 AM: Python version set to 2.7
8:50:31 AM: v16.13.1 is already installed.
8:50:31 AM: Now using node v16.13.1 (npm v8.1.2)
8:50:32 AM: Started restoring cached build plugins
8:50:32 AM: Finished restoring cached build plugins
8:50:32 AM: Attempting ruby version 2.7.2, read from environment
8:50:33 AM: Using ruby version 2.7.2
8:50:34 AM: Using PHP version 8.0
8:50:34 AM: Started restoring cached node modules
8:50:34 AM: Finished restoring cached node modules
8:50:34 AM: Installing NPM modules using NPM version 8.1.2
8:55:17 AM: npm ERR! make: Entering directory ‘/opt/build/repo/node_modules/node-sass/build’

8:55:17 AM: npm ERR! make: Leaving directory ‘/opt/build/repo/node_modules/node-sass/build’
8:55:17 AM: npm ERR! gyp info it worked if it ends with ok
8:55:17 AM: npm ERR! gyp verb cli [
8:55:17 AM: npm ERR! gyp verb cli ‘/opt/buildhome/.nvm/versions/node/v16.13.1/bin/node’,
8:55:17 AM: npm ERR! gyp verb cli ‘/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js’,
8:55:17 AM: npm ERR! gyp verb cli ‘rebuild’,
8:55:17 AM: npm ERR! gyp verb cli ‘–verbose’,
8:55:17 AM: npm ERR! gyp verb cli ‘–libsass_ext=’,
8:55:17 AM: npm ERR! gyp verb cli ‘–libsass_cflags=’,
8:55:17 AM: npm ERR! gyp verb cli ‘–libsass_ldflags=’,
8:55:17 AM: npm ERR! gyp verb cli ‘–libsass_library=’
8:55:17 AM: npm ERR! gyp verb cli ]
8:55:17 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
8:55:17 AM: npm ERR! gyp info using node-gyp@3.8.0
8:55:17 AM: npm ERR! gyp info using node@16.13.1 | linux | x64
8:55:17 AM: npm ERR! gyp verb command rebuild
8:55:17 AM: npm ERR! gyp verb command clean
8:55:17 AM: npm ERR! gyp verb clean removing “build” directory
8:55:17 AM: npm ERR! gyp verb command configure
8:55:17 AM: npm ERR! gyp verb check python checking for Python executable “python2” in the PATH
8:55:17 AM: npm ERR! gyp verb which succeeded python2 /opt/buildhome/python2.7/bin/python2
8:55:17 AM: npm ERR! gyp verb check python version /opt/buildhome/python2.7/bin/python2 -c "import sys; print "2.7.18npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j
8:55:17 AM: npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.13.1

8:55:17 AM: npm ERR! (node:1509) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
8:55:17 AM: npm ERR! (Use node --trace-deprecation ... to show where the warning was created)
8:55:17 AM: npm ERR! gyp verb config.gypi checking for gypi file: /opt/build/repo/node_modules/node-sass/config.gypi
8:55:17 AM: npm ERR! gyp verb common.gypi checking for gypi file: /opt/build/repo/node_modules/node-sass/common.gypi
8:55:17 AM: npm ERR! gyp verb gyp gyp format was not specified; forcing “make”
8:55:17 AM: npm ERR! gyp info spawn /opt/buildhome/python2.7/bin/python2
8:55:17 AM: npm ERR! gyp info spawn args [
8:55:17 AM: npm ERR! gyp info spawn args ‘/opt/build/repo/node_modules/node-gyp/gyp/gyp_main.py’,
8:55:17 AM: npm ERR! gyp info spawn args ‘binding.gyp’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-f’,
8:55:17 AM: npm ERR! gyp info spawn args ‘make’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-I’,
8:55:17 AM: npm ERR! gyp info spawn args ‘/opt/build/repo/node_modules/node-sass/build/config.gypi’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-I’,
8:55:17 AM: npm ERR! gyp info spawn args ‘/opt/build/repo/node_modules/node-gyp/addon.gypi’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-I’,
8:55:17 AM: npm ERR! gyp info spawn args ‘/opt/buildhome/.node-gyp/16.13.1/include/node/common.gypi’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dlibrary=shared_library’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dvisibility=default’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dnode_root_dir=/opt/buildhome/.node-gyp/16.13.1’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dnode_gyp_dir=/opt/build/repo/node_modules/node-gyp’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dnode_lib_file=/opt/buildhome/.node-gyp/16.13.1/<(target_arch)/node.lib’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dmodule_root_dir=/opt/build/repo/node_modules/node-sass’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Dnode_engine=v8’,
8:55:17 AM: npm ERR! gyp info spawn args ‘–depth=.’,
8:55:17 AM: npm ERR! gyp info spawn args ‘–no-parallel’,
8:55:17 AM: npm ERR! gyp info spawn args ‘–generator-output’,
8:55:17 AM: npm ERR! gyp info spawn args ‘build’,
8:55:17 AM: npm ERR! gyp info spawn args ‘-Goutput_dir=.’
8:55:17 AM: npm ERR! gyp info spawn args ]
8:55:17 AM: npm ERR! gyp verb command build
8:55:17 AM: npm ERR! gyp verb build type Release
8:55:17 AM: npm ERR! gyp verb architecture x64
8:55:17 AM: npm ERR! gyp verb node dev dir /opt/buildhome/.node-gyp/16.13.1
8:55:17 AM: npm ERR! gyp verb which succeeded for make /usr/bin/make
8:55:17 AM: npm ERR! gyp info spawn make
8:55:17 AM: npm ERR! gyp info spawn args [ ‘V=1’, ‘BUILDTYPE=Release’, ‘-C’, ‘build’ ]
8:55:17 AM: npm ERR! …/src/libsass/src/cencode.c: In function ‘base64_encode_block’:
8:55:17 AM: npm ERR! …/src/libsass/src/cencode.c:48:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
8:55:17 AM: npm ERR! 48 | result = (fragment & 0x003) << 4;
8:55:17 AM: npm ERR! | ~^~~~~~~~~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/libsass/src/cencode.c:52:2: note: here
8:55:17 AM: npm ERR! 52 | case step_B:
8:55:17 AM: npm ERR! | ^~~~
8:55:17 AM: npm ERR! …/src/libsass/src/cencode.c:62:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
8:55:17 AM: npm ERR! 62 | result = (fragment & 0x00f) << 2;
8:55:17 AM: npm ERR! | ~^~~~~~~~~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/libsass/src/cencode.c:66:2: note: here
8:55:17 AM: npm ERR! 66 | case step_C:
8:55:17 AM: npm ERR! | ^~~~
8:55:17 AM: npm ERR! …/src/libsass/src/functions.cpp: In function ‘void Sass::Functions::handle_utf8_error(const Sass::ParserState&, Sass::Backtraces)’:
8:55:17 AM: npm ERR! …/src/libsass/src/functions.cpp:110:20: warning: catching polymorphic type ‘class utf8::invalid_code_point’ by value [-Wcatch-value=]
8:55:17 AM: npm ERR! 110 | catch (utf8::invalid_code_point) {
8:55:17 AM: npm ERR! | ^~~~~~~~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/libsass/src/functions.cpp:114:20: warning: catching polymorphic type ‘class utf8::not_enough_room’ by value [-Wcatch-value=]
8:55:17 AM: npm ERR! 114 | catch (utf8::not_enough_room) {
8:55:17 AM: npm ERR! | ^~~~~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/libsass/src/functions.cpp:118:20: warning: catching polymorphic type ‘class utf8::invalid_utf8’ by value [-Wcatch-value=]
8:55:17 AM: npm ERR! 118 | catch (utf8::invalid_utf8) {
8:55:17 AM: npm ERR! | ^~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/libsass/src/json.cpp: In function ‘char* json_encode_string(const char*)’:
8:55:17 AM: npm ERR! …/src/libsass/src/json.cpp:405:15: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
8:55:17 AM: npm ERR! 405 | catch (std::exception) {
8:55:17 AM: npm ERR! | ^~~~~~~~~
8:55:17 AM: npm ERR! …/src/libsass/src/json.cpp: In function ‘char* json_stringify(const JsonNode*, const char*)’:
8:55:17 AM: npm ERR! …/src/libsass/src/json.cpp:424:15: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
8:55:17 AM: npm ERR! 424 | catch (std::exception) {
8:55:17 AM: npm ERR! | ^~~~~~~~~
8:55:17 AM: npm ERR! In file included from /opt/buildhome/.node-gyp/16.13.1/include/node/v8.h:30,
8:55:17 AM: npm ERR! from /opt/buildhome/.node-gyp/16.13.1/include/node/node.h:63,
8:55:17 AM: npm ERR! from …/…/nan/nan.h:58,
8:55:17 AM: npm ERR! from …/src/binding.cpp:1:
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
8:55:17 AM: npm ERR! 492 | !std::is_same<Data, std::remove_cv_t>::value>::Perform(data);
8:55:17 AM: npm ERR! | ^~~~~~~~~~~
8:55:17 AM: npm ERR! | remove_cv
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
8:55:17 AM: npm ERR! 492 | !std::is_same<Data, std::remove_cv_t>::value>::Perform(data);
8:55:17 AM: npm ERR! | ^~~~~~~~~~~
8:55:17 AM: npm ERR! | remove_cv
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/v8-internal.h:492:50: error: template argument 2 is invalid
8:55:17 AM: npm ERR! 492 | !std::is_same<Data, std::remove_cv_t>::value>::Perform(data);
8:55:17 AM: npm ERR! | ^
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/v8-internal.h:492:63: error: ‘::Perform’ has not been declared
8:55:17 AM: npm ERR! 492 | !std::is_same<Data, std::remove_cv_t>::value>::Perform(data);
8:55:17 AM: npm ERR! | ^~~~~~~
8:55:17 AM: npm ERR! …/src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render(Nan::NAN_METHOD_ARGS_TYPE)’:
8:55:17 AM: npm ERR! …/src/binding.cpp:284:98: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
8:55:17 AM: npm ERR! 284 | int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
8:55:17 AM: npm ERR! | ^~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render_file(Nan::NAN_METHOD_ARGS_TYPE)’:
8:55:17 AM: npm ERR! …/src/binding.cpp:320:98: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
8:55:17 AM: npm ERR! 320 | int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
8:55:17 AM: npm ERR! | ^~~~~~~~~~~~
8:55:17 AM: npm ERR! In file included from …/…/nan/nan.h:58,
8:55:17 AM: npm ERR! from …/src/binding.cpp:1:
8:55:17 AM: npm ERR! …/src/binding.cpp: At global scope:
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/node.h:821:43: warning: cast between incompatible function types from ‘void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void ()(v8::Localv8::Object)’} to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void)’} [-Wcast-function-type]
8:55:17 AM: npm ERR! 821 | (node::addon_register_func) (regfunc),
8:55:17 AM: npm ERR! | ^
8:55:17 AM: npm ERR! /opt/buildhome/.node-gyp/16.13.1/include/node/node.h:855:3: note: in expansion of macro ‘NODE_MODULE_X’
8:55:17 AM: npm ERR! 855 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
8:55:17 AM: npm ERR! | ^~~~~~~~~~~~~
8:55:17 AM: npm ERR! …/src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
8:55:17 AM: npm ERR! 358 | NODE_MODULE(binding, RegisterModule);
8:55:17 AM: npm ERR! | ^~~~~~~~~~~
8:55:17 AM: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
8:55:17 AM: npm ERR! gyp ERR! build error
8:55:17 AM: npm ERR! gyp ERR! stack Error: make failed with exit code: 2
8:55:17 AM: npm ERR! gyp ERR! stack at ChildProcess.onExit (/opt/build/repo/node_modules/node-gyp/lib/build.js:262:23)
8:55:17 AM: npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
8:55:17 AM: npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
8:55:17 AM: npm ERR! gyp ERR! System Linux 4.19.167+
8:55:17 AM: npm ERR! gyp ERR! command “/opt/buildhome/.nvm/versions/node/v16.13.1/bin/node” “/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
8:55:17 AM: npm ERR! gyp ERR! cwd /opt/build/repo/node_modules/node-sass
8:55:17 AM: npm ERR! gyp ERR! node -v v16.13.1
8:55:17 AM: npm ERR! gyp ERR! node-gyp -v v3.8.0
8:55:17 AM: npm ERR! gyp ERR! not ok
8:55:17 AM: npm ERR! Build failed with error code: 1
8:55:17 AM: npm ERR! A complete log of this run can be found in:
8:55:17 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-12-09T13_55_17_110Z-debug.log
8:55:17 AM: Error during NPM install
8:55:17 AM: Build was terminated: Build script returned non-zero exit code: 1
8:55:17 AM: Failing build: Failed to build site
8:55:17 AM: Finished processing build request in 4m49.512010793s

Try setting Node version to 14.17.5. How to do that is here:

I created an .nvmrc and changed to 14.17.5
The build worked. Thank you thank you!