[英]npm install failed by gyp verb could not find "msbuild.exe" in PATH - finding location in registry
I encounter this problem when I execute npm install
command执行npm install
命令时遇到此问题
I tried to add the MSBuild.exe to PATH but can't success我试图将 MSBuild.exe 添加到 PATH 但无法成功
How can I process this problem?我该如何处理这个问题?
Before I have added to the python2 PATH,and tried npm install --global --production windows-build-tools
在我添加到 python2 路径之前,并尝试了npm install --global --production windows-build-tools
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir C:\Users\fzc\.node-gyp\16.5.0
npm ERR! gyp verb found first Solution file build/binding.sln
npm ERR! gyp verb could not find "msbuild.exe" in PATH - finding location in registry
npm ERR! gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\fzc\code\nx-admin\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\fzc\\code\\nx-admin\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\fzc\code\nx-admin\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.5.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
For me, running npm i -g windows-build-tools
from a command line with administrator privileges would hang during installation, but I was able to navigate to C:\Users\[username]\.windows-build-tools
and run vs_BuildTools.exe
file from there.对我来说,从具有管理员权限的命令行运行npm i -g windows-build-tools
会在安装过程中挂起,但我能够导航到C:\Users\[username]\.windows-build-tools
并运行vs_BuildTools.exe
文件从那里。 This worked its magic, and I was able to run npm install
as normal.这很神奇,我能够正常运行npm install
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.