node-gyp安裝vuetify編譯失敗gyp?ERR的問題及解決
問題
在安裝 vuetify 的時(shí)候發(fā)現(xiàn)了 node-gyp 編譯失敗的問題,報(bào)錯(cuò)很友好:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.0
gyp info using node@14.8.0 | win32 | x64
gyp info find Python using Python version 3.8.5 found at “D:\Program Files\Python38\python.exe”
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
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 not looking for VS2013 as it is only supported up to Node.js 8
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 **************************************************************
就是說找到了我們的 python 3.8 環(huán)境,還缺少 vs 環(huán)境,我們?nèi)ニ崾镜?https://github.com/nodejs/node-gyp#on-windows 看一下
我們不希望安裝整個(gè) vs ,太過于臃腫,所以我們選擇第一種方案。
解決
這里使用 npm 做全局安裝,使用 yarn 不能安裝,如果 npm 太慢可以在這里先配置一下淘寶鏡像源。
npm install --global --production windows-build-tools
之后會(huì)輸出正在安裝 python 2.7 :
還需要一套 vs 開發(fā) sdk ,他會(huì)靜默安裝,請(qǐng)耐心等待 C 盤空間減少 4 G 左右不再發(fā)生變化即可。
我們可以在系統(tǒng)程序管理中看到剛剛安裝的依賴:
管理安裝的依賴
在開始菜單使用 vs 安裝工具可以管理已經(jīng)安裝的依賴,方便以后卸載:
可以看到安裝了 2017 生成工具:
檢查 C 盤
靜默安裝我們不知道安裝到哪里了,檢查一下 C 盤確認(rèn)一下位置。
在 C:\Program Files (x86)
有 3.7 G 的依賴。
在 C:\ProgramData
有 500 M 的數(shù)據(jù)。
一共 4 G 多。
重新安裝
重新安裝 vuetify ,這里使用 yarn 安裝也可以(上面的構(gòu)建工具必須使用 npm 安裝):
成功安裝!
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Node中文件斷點(diǎn)續(xù)傳原理和方法總結(jié)
在之前做過一個(gè)小項(xiàng)目,涉及到了文件上傳,在大文件上面使用了斷點(diǎn)續(xù)傳,降低了服務(wù)器方面的壓力,現(xiàn)在小編把Node中文件斷點(diǎn)續(xù)傳原理和方法總結(jié)分享給大家,感興趣的朋友一起看看吧2022-01-01