安装项目依赖包时,报错:
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。
之后查了一下 用
npm i --global --product ion windows-build-tools
可以解决,结果执行之后再次报错:
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn powershell.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! windows-build-tools@5.1.0 postinstall: node ./dist/index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools@5.1.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-05-07T1
2_15_56_451Z-debug.log
求大佬救命
需要用管理员权限安装 这个,而且这个东西有坑
我安装了30次,反反复复安装卸载
我的基础环境
node: 12.0.0
electron: 5.0.2
python 2.7
vs2017 这个我现在换成vs2015 替换安装的语句是:
yarn global add windows-build-tools --vs2015
或者使用 npm 安装
npm install --global windows-build-tools --vs2015
任选一种;
注意!注意!注意! 安装这个需要使用管理员权限的cmd命令行
搜索cmd 右键,以管理员权限运行,然后再执行上面的安装
出现这个问题解决的方法是找到powershell.exe所在路径,我的是:C:\Windows\System32\WindowsPowerShell\v1.0
将这个路径添加到环境变量Path中
到处找解决方案,没想到就是一个管理员权限解决了,淦