NPM - 尝试安装依赖项时出现节点 sass 错误

NPM - node sass error when trying to install dependency

在使用节点 13.1.0 安装我的依赖项时收到一堆警告和错误。

c++ '-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_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/Users/marinosony/.node-gyp/13.1.0/include/node -I/Users/marinosony/.node-gyp/13.1.0/src -I/Users/marinosony/.node-gyp/13.1.0/deps/openssl/config -I/Users/marinosony/.node-gyp/13.1.0/deps/openssl/openssl/include -I/Users/marinosony/.node-gyp/13.1.0/deps/uv/include -I/Users/marinosony/.node-gyp/13.1.0/deps/zlib -I/Users/marinosony/.node-gyp/13.1.0/deps/v8/include -I../../nan -I../src/libsass/include -Os -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -std=c++11 -MMD -MF ./Release/.deps/Release/obj.target/binding/src/create_string.o.d.raw -c -o Release/obj.target/binding/src/create_string.o ../src/create_string.cpp ../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value' v8::String::Utf8Value string(value); ^ ~~~~~ /Users/marinosony/.node-gyp/13.1.0/include/node/v8.h:3064:5: note: candidate constructor not viable: no known conversion from 'v8::Local' to 'const v8::String::Utf8Value' for 1st argument Utf8Value(const Utf8Value&) = delete; ^ /Users/marinosony/.node-gyp/13.1.0/include/node/v8.h:3057:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided Utf8Value(Isolate* isolate, Local obj); ^ 1 error generated. make: *** [Release/obj.target/binding/src/create_string.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/marinosony/Desktop/SofiaPaySys/SofiaAPI/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Darwin 19.2.0 gyp ERR! command "/usr/local/Cellar/node/13.1.0/bin/node" "/Users/marinosony/Desktop/SofiaPaySys/SofiaAPI/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd /Users/marinosony/Desktop/SofiaPaySys/SofiaAPI/node_modules/node-sass gyp ERR! node -v v13.1.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok

这是版本问题尝试用--unsafe-perm安装它

sudo npm install -g --unsafe-perm node-sass 

我找到了答案。我不得不将我的节点版本降级到 10.16.0,将我的节点-sass 版本降级到 4.12.0。 感谢您的帮助。