简体   繁体   中英

running 'npm install' : Node-gyp error - MSBUILD.exe failed with exit code: 1

I'm running npm install to install all packages from my project on Windows.

And then I get this error about MSBUILD.exe:

gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit
 code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194: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 Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\
node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\masso\\Desktop\\Stage 2019\\maev2-front-
master\\node_modules\\grpc\\src\\node\\extension_binary\\node-v72-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--m
odule_path=C:\\Users\\masso\\Desktop\\Stage 2019\\maev2-front-master\\node_modules\\grpc\\src\\node\\extension_binary\\node-v72-win
32-x64-unknown" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd C:\Users\masso\Desktop\Stage 2019\maev2-front-master\node_modules\grpc
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_mo
dules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\masso\Desktop\Stage 2019\maev2-
front-master\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module
_path=C:\Users\masso\Desktop\Stage 2019\maev2-front-master\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown -
-napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\masso\Desktop\Stage 2019\maev2-front-master\node_modules\grpc\nod
e_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Windows_NT 10.0.18362
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\masso\\Desktop\\Stage 2019\\maev2-front-master\\node_mo
dules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\Users\masso\Desktop\Stage 2019\maev2-front-master\node_modules\grpc
node-pre-gyp ERR! node -v v12.14.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok```

I have try many things like installing package `windows-build-tools`, running `npm install` with --no-optional option and some others I don't remember. Nothing actualy worked.

If someone could try to help him please.

Kind regards.

uninstall node and install node version less then Node v11.15, it is the latest version where node-gyp is working!!!

For example, I used v 11.14

I faced a similar problem, after updating npm to its latest problem resolved

npm install npm@latest -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM