运行 npm install时报错:
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microso
ft Visual Studio 200
5;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [E:mogu-cms-front
ode_modules
ode-sassuildinding.sln]
错误原因:
缺少windows构建插件
解决办法:
1 npm install --global --production windows-build-tools 比较漫长 2 npm install -g node-gyp
错误:v8::String::Utf8Value
详细错误:
1 ../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value' 2 v8::String::Utf8Value string(value); 3 ^ ~~~~~ 4 /Users/hongsen.ren/.node-gyp/12.1.0/include/node/v8.h:3002:5: note: candidate constructor not viable: no known 5 conversion from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value' for 1st argument 6 Utf8Value(const Utf8Value&) = delete; 7 ^ 8 /Users/hongsen.ren/.node-gyp/12.1.0/include/node/v8.h:2995:5: note: candidate constructor not viable: requires 9 2 arguments, but 1 was provided 10 Utf8Value(Isolate* isolate, Local<v8::Value> obj); 11 ^ 12 1 error generated. 13 make: *** [Release/obj.target/binding/src/create_string.o] Error 1 14 gyp ERR! build error 15 gyp ERR! stack Error: `make` failed with exit code: 2 16 gyp ERR! stack at ChildProcess.onExit (/Users/hongsen.ren/code/bk_cmdb/bk-cmdb/src/ui/node_modules/node-gyp/lib/build.js:262:23) 17 gyp ERR! stack at ChildProcess.emit (events.js:196:13) 18 gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12) 19 gyp ERR! System Darwin 18.6.0 20 gyp ERR! command "/usr/local/Cellar/node/12.1.0/bin/node" "/Users/hongsen.ren/code/bk_cmdb/bk-cmdb/src/ui/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" 21 gyp ERR! cwd /Users/hongsen.ren/code/bk_cmdb/bk-cmdb/src/ui/node_modules/node-sass 22 gyp ERR! node -v v12.1.0 23 gyp ERR! node-gyp -v v3.8.0 24 gyp ERR! not ok 25 Build failed with error code: 1
原因:nodejs和node-sass的版本没对应上
nodejs和node-sass版本对应:
网址:https://www.npmjs.com/package/node-sass
转自:https://www.jianshu.com/p/f77942c2a1c9