我在Windows 7 PC上将nodejs版本从8升级到12。升级后,我清理了我的nodejs项目的node_modules并执行了npm install
。但是失败,并显示以下错误。
......
......
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
win_delay_load_hook.cc
z.vcxproj -> D:\projects\myproject\node_modules\grpc\build\Release\\libz.lib
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\program_files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\program_files\\nodejs\\node.exe" "D:\\program_files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=D:\\projects\\myproject\\node_modules\\grpc\\src\\node\\extension_binary\\node-v72-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=D:\\projects\\myproject\\node_modules\\grpc\\src\\node\\extension_binary\\node-v72-win32-x64-unknown" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd D:\projects\myproject\node_modules\grpc
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
任何想法如何解决这个问题?我试图通过npm install --global windows-build-tools
升级Windows构建工具,但看起来npm在程序文件中使用相同的msbuild.exe。