-
打开powerShell(管理员模式)
win +x 选择 Windows PowerShell(管理员)
-
安装C ++构建工具:npm i --vs2015 --global windows-build-tools
- 容易发生的下面提示,直接重新安装,一定加上 --vs2015(--vs2017更新了最新的.net framework依旧不行,知道的朋友可以留言)
- could not install Visual Studio Build Tools...
- still waiting for installer log file ...(一定不要死等,不然会死的很惨,理解为安装报错)
- .net framework开发包下载链接:dotnet.microsoft.com/download/vi…
- 整个周期在2-3分钟,成功截
-
安装node-gyp: npm i -g node-gyp
- 报错提示
if not defined npm_config_node_gyp(...
- 解决方法改环境变量(win + r -> SystemPropertiesAdvanced.exe -> 环境变量 -> 用户path_ )
-
配置 npm config
npm config set msvs_version 2015
npm config set python C:\Users\allen\.windows-build-tools\python27 -
验证是否成功