如果我在本地运行npm run build
命令,并在netlify中拖放build
文件夹,那么它是托管的,但它给出了这个大错误。
当我尝试从我的github仓库进行持续部署时。这是开始时显示的错误
11:51:47 PM: npm WARN deprecated [email protected]: 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.
11:54:08 PM: npm ERR! code 1
11:54:08 PM: npm ERR! path /opt/build/repo/node_modules/node-sass
11:54:08 PM: npm ERR! command failed
11:54:08 PM: npm ERR! command sh -c node scripts/build.js
11:54:08 PM: npm ERR! Building: /opt/buildhome/.nvm/versions/node/v16.8.0/bin/node /opt/build/repo/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
11:54:08 PM: npm ERR! make: Entering directory '/opt/build/repo/node_modules/node-sass/build'
11:54:08 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.8.0/include/node -I/opt/buildhome/.node-gyp/16.8.0/src -I/opt/buildhome/.node-gyp/16.8.0/deps/openssl/config -I/opt/buildhome/.node-gyp/16.8.0/deps/openssl/openssl/include -I/opt/buildhome/.node-gyp/16.8.0/deps/uv/include -I/opt/buildhome/.node-gyp/16.8.0/deps/zlib -I/opt/buildhome/.node-gyp/16.8.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
11:54:08 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.8.0/include/node -I/opt/buildhome/.node-gyp/16.8.0/src -I/opt/buildhome/.node-gyp/16.8.0/deps/openssl/config -I/opt/buildhome/.node-gyp/16.8.0/deps/openssl/openssl/include -I/opt/buildhome/.node-gyp/16.8.0/deps/uv/include -I/opt/buildhome/.node-gyp/16.8.0/deps/zlib -I/opt/buildhome/.node-gyp/16.8.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_fwd_decl.o.d.raw -c -o Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o ../src/libsass/src/ast_fwd_decl.cpp
11:54:08 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.8.0/include/node -I/opt/buildhome/.node-gyp/16.8.0/src -I/opt/buildhome/.node-gyp/16.8.0/deps/openssl/config -I/opt/buildhome/.node-gyp/16.8.0/deps/openssl/openssl/include -I/opt/buildhome/.node-gyp/16.8.0/deps/uv/include -I/opt/buildhome/.node-gyp/16.8.0/deps/zlib -I/opt/buildhome/.node-gyp/16.8.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/backtrace.o.d.raw -c -o Release/obj.target/libsass/src/libsass/src/backtrace.o ../src/libsass/src/backtrace.cpp
字符串
到此为止
11:54:08 PM: npm ERR! gyp ERR! node -v v16.8.0
11:54:08 PM: npm ERR! gyp ERR! node-gyp -v v3.8.0
11:54:08 PM: npm ERR! gyp ERR! not ok
11:54:08 PM: npm ERR! Build failed with error code: 1
11:54:08 PM: npm ERR! A complete log of this run can be found in:
11:54:08 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-08-27T18_24_08_951Z-debug.log
11:54:09 PM: Error during NPM install
11:54:09 PM: Build was terminated: Build script returned non-zero exit code: 1
11:54:09 PM: Failing build: Failed to build site
11:54:09 PM: Finished processing build request in 3m28.53038114s
型
2条答案
按热度按时间cbjzeqam1#
我今天遇到了同样的问题。我意识到Netlify现在默认使用的是node 16.x,这与node-sass和其他依赖项不兼容。
您可以通过转到**“部署设置”>“环境”>“编辑变量”并添加NODE_VERSION = [版本号]**(例如,14可运行节点最新版本14.x),在Netlify环境中强制使用节点版本。
请参阅https://docs.netlify.com/configure-builds/manage-dependencies/。
m3eecexj2#
您可以在环境变量中创建NPM_FLAGS,以便在npm install命令中使用自定义标志。变量名
NPM_FLAGS
,值:-f
. https://docs.netlify.com/configure-builds/manage-dependencies/