Failing to deploy a Gatsby site from a Github repository

I need advice to debug deploy Netlify App

Pasting the last part of deploy log… Any idea what’s going on?

8:04:12 AM: npm ERR! gyp info spawn args   '-Dnode_root_dir=/opt/buildhome/.cache/node-gyp/16.9.0',
8:04:12 AM: npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/opt/build/repo/node_modules/node-gyp',
8:04:12 AM: npm ERR! gyp info spawn args   '-Dnode_lib_file=/opt/buildhome/.cache/node-gyp/16.9.0/<(target_arch)/node.lib',
8:04:12 AM: npm ERR! gyp info spawn args   '-Dmodule_root_dir=/opt/build/repo/node_modules/node-sass',
8:04:12 AM: npm ERR! gyp info spawn args   '-Dnode_engine=v8',
8:04:12 AM: npm ERR! gyp info spawn args   '--depth=.',
8:04:12 AM: npm ERR! gyp info spawn args   '--no-parallel',
8:04:12 AM: npm ERR! gyp info spawn args   '--generator-output',
8:04:12 AM: npm ERR! gyp info spawn args   'build',
8:04:12 AM: npm ERR! gyp info spawn args   '-Goutput_dir=.'
8:04:12 AM: npm ERR! gyp info spawn args ]
8:04:12 AM: npm ERR! gyp verb command build []
8:04:12 AM: npm ERR! gyp verb build type Release
8:04:12 AM: npm ERR! gyp verb architecture x64
8:04:12 AM: npm ERR! gyp verb node dev dir /opt/buildhome/.cache/node-gyp/16.9.0
8:04:12 AM: npm ERR! gyp verb `which` succeeded for `make` /usr/bin/make
8:04:12 AM: npm ERR! gyp info spawn make
8:04:12 AM: npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
8:04:12 AM: npm ERR! ../src/libsass/src/cencode.c: In function ‘base64_encode_block’:
8:04:12 AM: npm ERR! ../src/libsass/src/cencode.c:48:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
8:04:12 AM: npm ERR!    48 |    result = (fragment & 0x003) << 4;
8:04:12 AM: npm ERR!       |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/libsass/src/cencode.c:52:2: note: here
8:04:12 AM: npm ERR!    52 |  case step_B:
8:04:12 AM: npm ERR!       |  ^~~~
8:04:12 AM: npm ERR! ../src/libsass/src/cencode.c:62:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
8:04:12 AM: npm ERR!    62 |    result = (fragment & 0x00f) << 2;
8:04:12 AM: npm ERR!       |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/libsass/src/cencode.c:66:2: note: here
8:04:12 AM: npm ERR!    66 |  case step_C:
8:04:12 AM: npm ERR!       |  ^~~~
8:04:12 AM: npm ERR! ../src/libsass/src/functions.cpp: In function ‘void Sass::Functions::handle_utf8_error(const Sass::ParserState&, Sass::Backtraces)’:
8:04:12 AM: npm ERR! ../src/libsass/src/functions.cpp:110:20: warning: catching polymorphic type ‘class utf8::invalid_code_point’ by value [-Wcatch-value=]
8:04:12 AM: npm ERR!   110 |       catch (utf8::invalid_code_point) {
8:04:12 AM: npm ERR!       |                    ^~~~~~~~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/libsass/src/functions.cpp:114:20: warning: catching polymorphic type ‘class utf8::not_enough_room’ by value [-Wcatch-value=]
8:04:12 AM: npm ERR!   114 |       catch (utf8::not_enough_room) {
8:04:12 AM: npm ERR!       |                    ^~~~~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/libsass/src/functions.cpp:118:20: warning: catching polymorphic type ‘class utf8::invalid_utf8’ by value [-Wcatch-value=]
8:04:12 AM: npm ERR!   118 |       catch (utf8::invalid_utf8) {
8:04:12 AM: npm ERR!       |                    ^~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/libsass/src/json.cpp: In function ‘char* json_encode_string(const char*)’:
8:04:12 AM: npm ERR! ../src/libsass/src/json.cpp:405:15: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
8:04:12 AM: npm ERR!   405 |   catch (std::exception) {
8:04:12 AM: npm ERR!       |               ^~~~~~~~~
8:04:12 AM: npm ERR! ../src/libsass/src/json.cpp: In function ‘char* json_stringify(const JsonNode*, const char*)’:
8:04:12 AM: npm ERR! ../src/libsass/src/json.cpp:424:15: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
8:04:12 AM: npm ERR!   424 |   catch (std::exception) {
8:04:12 AM: npm ERR!       |               ^~~~~~~~~
8:04:12 AM: npm ERR! In file included from /opt/buildhome/.cache/node-gyp/16.9.0/include/node/v8.h:30,
8:04:12 AM: npm ERR!                  from /opt/buildhome/.cache/node-gyp/16.9.0/include/node/node.h:63,
8:04:12 AM: npm ERR!                  from ../../nan/nan.h:56,
8:04:12 AM: npm ERR!                  from ../src/binding.cpp:1:
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/v8-internal.h:489:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
8:04:12 AM: npm ERR!   489 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
8:04:12 AM: npm ERR!       |                                      ^~~~~~~~~~~
8:04:12 AM: npm ERR!       |                                      remove_cv
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/v8-internal.h:489:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
8:04:12 AM: npm ERR!   489 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
8:04:12 AM: npm ERR!       |                                      ^~~~~~~~~~~
8:04:12 AM: npm ERR!       |                                      remove_cv
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/v8-internal.h:489:50: error: template argument 2 is invalid
8:04:12 AM: npm ERR!   489 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
8:04:12 AM: npm ERR!       |                                                  ^
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/v8-internal.h:489:63: error: ‘::Perform’ has not been declared
8:04:12 AM: npm ERR!   489 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
8:04:12 AM: npm ERR!       |                                                               ^~~~~~~
8:04:12 AM: npm ERR! ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render(Nan::NAN_METHOD_ARGS_TYPE)’:
8:04:12 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:04:12 AM: npm ERR!   284 |     int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
8:04:12 AM: npm ERR!       |                                                                                                  ^~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render_file(Nan::NAN_METHOD_ARGS_TYPE)’:
8:04:12 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:04:12 AM: npm ERR!   320 |     int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
8:04:12 AM: npm ERR!       |                                                                                                  ^~~~~~~~~~~~
8:04:12 AM: npm ERR! In file included from ../../nan/nan.h:56,
8:04:12 AM: npm ERR!                  from ../src/binding.cpp:1:
8:04:12 AM: npm ERR! ../src/binding.cpp: At global scope:
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/node.h:810:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
8:04:12 AM: npm ERR!   810 |       (node::addon_register_func) (regfunc),                          \
8:04:12 AM: npm ERR!       |                                           ^
8:04:12 AM: npm ERR! /opt/buildhome/.cache/node-gyp/16.9.0/include/node/node.h:844:3: note: in expansion of macro ‘NODE_MODULE_X’
8:04:12 AM: npm ERR!   844 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
8:04:12 AM: npm ERR!       |   ^~~~~~~~~~~~~
8:04:12 AM: npm ERR! ../src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
8:04:12 AM: npm ERR!   358 | NODE_MODULE(binding, RegisterModule);
8:04:12 AM: npm ERR!       | ^~~~~~~~~~~
8:04:12 AM: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
8:04:12 AM: npm ERR! gyp ERR! build error
8:04:12 AM: npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
8:04:12 AM: npm ERR! gyp ERR! stack     at ChildProcess.onExit (/opt/build/repo/node_modules/node-gyp/lib/build.js:194:23)
8:04:12 AM: npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
8:04:12 AM: npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
8:04:12 AM: npm ERR! gyp ERR! System Linux 4.19.167+
8:04:12 AM: npm ERR! gyp ERR! command "/opt/buildhome/.nvm/versions/node/v16.9.0/bin/node" "/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
8:04:12 AM: npm ERR! gyp ERR! cwd /opt/build/repo/node_modules/node-sass
8:04:12 AM: npm ERR! gyp ERR! node -v v16.9.0
8:04:12 AM: npm ERR! gyp ERR! node-gyp -v v7.1.2
8:04:12 AM: npm ERR! gyp ERR! not ok
8:04:12 AM: npm ERR! Build failed with error code: 1
8:04:13 AM: npm ERR! A complete log of this run can be found in:
8:04:13 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-09-10T06_04_12_979Z-debug.log
8:04:13 AM: Error during NPM install
8:04:13 AM: Build was terminated: Build script returned non-zero exit code: 1
8:04:13 AM: Failing build: Failed to build site
8:04:13 AM: Finished processing build request in 5m21.892710378s

You need to try setting an environment variable named NODE_VERSION with the value 14.17.5.