報(bào)錯(cuò)信息:
```bash
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS running in VS Command Prompt, installation path is:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
gyp ERR! find VS - will only use this version
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS looking for Visual Studio 2013
gyp ERR! find VS - not found
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
dio.js:121:47)
gyp ERR! stack at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:310:5)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Windows_NT 10.0.15063
解決辦法
1、卸載nodejs重新安裝一遍
2、設(shè)置淘寶鏡像 npm config set registry https://registry.npm.taobao.org
3、安裝nodejs所需的環(huán)境(Visual Studio XX、python什么鬼的),執(zhí)行這個(gè)命令會(huì)自動(dòng)檢測(cè)并幫你安裝好,npm install --g --production windows-build-tools
4、關(guān)鍵所在?。?!執(zhí)行編譯時(shí)指定python版本,npm install --python=python2.7
由于我的電腦之前安裝過(guò)python3版本,并且設(shè)置了環(huán)境變量,所以npm install會(huì)找我默認(rèn)的python,所以執(zhí)行時(shí)指定nodejs只支持的python2版本。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-534226.html
然后,神奇的事情到了,我把編譯包modules刪掉后重新編譯(這次不指定python2版本直接npm install),居然奇跡般的又沒(méi)有報(bào)錯(cuò)?。?!想不通。。。難道npm會(huì)將上次編譯成功的配置保存下來(lái)??算了不糾結(jié)了哭泣!文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-534226.html
到了這里,關(guān)于npm install齊天大坑!??!gyp ERR! find VS msvs_version not set from command line or npm config的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!