Home
Support Forums

Cannot deploy to Netlify but can build locally

Hi there,

Having an issue deploying to Netlify. Everything is setup properly to deploy but the build fails.

The build works locally, fails on Netlify.

Here’s the full log below. I’m at my wit’s end. I’ve been trying for hours to solve this.

7:13:47 PM: npm ERR! code 1
7:13:47 PM: npm ERR! path /opt/build/repo/node_modules/node-sass
7:13:47 PM: npm ERR! command failed
7:13:47 PM: npm ERR! command sh -c node scripts/build.js
7:13:47 PM: npm ERR! Building: /opt/buildhome/.nvm/versions/node/v16.10.0/bin/node /opt/build/repo/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
7:13:47 PM: npm ERR! make: Entering directory '/opt/build/repo/node_modules/node-sass/build'
7:13:47 PM: npm ERR!   g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/opt/buildhome/.node-gyp/16.10.0/include/node -I/opt/buildhome/.node-gyp/16.10.0/src -I/opt/buildhome/.node-gyp/16.10.0/deps/openssl/config -I/opt/buildhome/.node-gyp/16.10.0/deps/openssl/openssl/include -I/opt/buildhome/.node-gyp/16.10.0/deps/uv/include -I/opt/buildhome/.node-gyp/16.10.0/deps/zlib -I/opt/buildhome/.node-gyp/16.10.0/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
7:13:48 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
7:13:47 PM: npm ERR!   rm -f Release/obj.target/src/sass.a && ar crs Release/obj.target/src/sass.a Release/obj.target/libsass/src/libsass/src/ast.o Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o Release/obj.target/libsass/src/libsass/src/backtrace.o Release/obj.target/libsass/src/libsass/src/base64vlq.o Release/obj.target/libsass/src/libsass/src/bind.o Release/obj.target/libsass/src/libsass/src/cencode.o Release/obj.target/libsass/src/libsass/src/check_nesting.o Release/obj.target/libsass/src/libsass/src/color_maps.o Release/obj.target/libsass/src/libsass/src/constants.o Release/obj.target/libsass/src/libsass/src/context.o Release/obj.target/libsass/src/libsass/src/cssize.o Release/obj.target/libsass/src/libsass/src/emitter.o Release/obj.target/libsass/src/libsass/src/environment.o Release/obj.target/libsass/src/libsass/src/error_handling.o Release/obj.target/libsass/src/libsass/src/eval.o Release/obj.target/libsass/src/libsass/src/expand.o Release/obj.target/libsass/src/libsass/src/extend.o Release/obj.target/libsass/src/libsass/src/file.o Release/obj.target/libsass/src/libsass/src/functions.o Release/obj.target/libsass/src/libsass/src/inspect.o Release/obj.target/libsass/src/libsass/src/json.o Release/obj.target/libsass/src/libsass/src/lexer.o Release/obj.target/libsass/src/libsass/src/listize.o Release/obj.target/libsass/src/libsass/src/memory/SharedPtr.o Release/obj.target/libsass/src/libsass/src/node.o Release/obj.target/libsass/src/libsass/src/operators.o Release/obj.target/libsass/src/libsass/src/output.o Release/obj.target/libsass/src/libsass/src/parser.o Release/obj.target/libsass/src/libsass/src/plugins.o Release/obj.target/libsass/src/libsass/src/position.o Release/obj.target/libsass/src/libsass/src/prelexer.o Release/obj.target/libsass/src/libsass/src/remove_placeholders.o Release/obj.target/libsass/src/libsass/src/sass.o Release/obj.target/libsass/src/libsass/src/sass2scss.o Release/obj.target/libsass/src/libsass/src/sass_context.o Release/obj.target/libsass/src/libsass/src/sass_functions.o Release/obj.target/libsass/src/libsass/src/sass_util.o Release/obj.target/libsass/src/libsass/src/sass_values.o Release/obj.target/libsass/src/libsass/src/source_map.o Release/obj.target/libsass/src/libsass/src/subset_map.o Release/obj.target/libsass/src/libsass/src/to_c.o Release/obj.target/libsass/src/libsass/src/to_value.o Release/obj.target/libsass/src/libsass/src/units.o Release/obj.target/libsass/src/libsass/src/utf8_string.o Release/obj.target/libsass/src/libsass/src/util.o Release/obj.target/libsass/src/libsass/src/values.o
7:13:47 PM: npm ERR!   rm -rf "Release/sass.a" && cp -af "Release/obj.target/src/sass.a" "Release/sass.a"
7:13:47 PM: npm ERR!   g++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/opt/buildhome/.node-gyp/16.10.0/include/node -I/opt/buildhome/.node-gyp/16.10.0/src -I/opt/buildhome/.node-gyp/16.10.0/deps/openssl/config -I/opt/buildhome/.node-gyp/16.10.0/deps/openssl/openssl/include -I/opt/buildhome/.node-gyp/16.10.0/deps/uv/include -I/opt/buildhome/.node-gyp/16.10.0/deps/zlib -I/opt/buildhome/.node-gyp/16.10.0/deps/v8/include -I../../nan -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -std=c++0x -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw   -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
7:13:47 PM: npm ERR! make: Leaving directory '/opt/build/repo/node_modules/node-sass/build'
7:13:47 PM: npm ERR! gyp info it worked if it ends with ok
7:13:47 PM: npm ERR! gyp verb cli [
7:13:47 PM: npm ERR! gyp verb cli   '/opt/buildhome/.nvm/versions/node/v16.10.0/bin/node',
7:13:47 PM: npm ERR! gyp verb cli   '/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js',
7:13:47 PM: npm ERR! gyp verb cli   'rebuild',
7:13:47 PM: npm ERR! gyp verb cli   '--verbose',
7:13:47 PM: npm ERR!Error during NPM install
7:13:47 PM: Build was terminated: Build script returned non-zero exit code: 1
7:13:48 PM: Failing build: Failed to build site
7:13:48 PM: Finished processing build request in 3m54.759988619s

Hi @GGS-Landscaping,

Could you try setting the environment variable NODE_VERSION to 14.17.5?