VSCode 启动 Vue 项目 npm install 报错
1.? 報(bào)錯(cuò)后,查看了版本。
? ? ? ?查看node版本:node -v
? ? ? ?查看npm版本:npm -v
? ? ? ?查看Augular版本:ng --version
2.? 感覺 Augular CLI版本太低,使用以下方法升級(jí)到最新版本:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?》 npm uninstall -g @angular/cli?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?》 npm cache verify (或 npm cache clean --force)?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?》 npm install -g @angular/cli@latest
? ? ? ?ng --version 后,已經(jīng)升級(jí)完成。
3.? yarn install 之后,發(fā)現(xiàn)是 node-sass 安裝失敗的問題。
4.? 解決方案: 》 npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
? ? ? ? ? ? ? ? ? ? ? ? 》?npm audit fix (若無high,可無需執(zhí)行此命令)
5.? 最后,執(zhí)行命令 npm start ,vue項(xiàng)目成功啟動(dòng)。
?
以下摘自別人總結(jié)的node-sass安裝失敗原因:
npm 安裝 node-sass 依賴時(shí),會(huì)從 github.com 上下載 .node 文件。由于國內(nèi)網(wǎng)絡(luò)環(huán)境的問題,這個(gè)下載時(shí)間可能會(huì)很長,甚至導(dǎo)致超時(shí)失敗。
解決方案就是使用其他源,或者使用工具下載,然后將安裝源指定到本地。
?
參考:https://segmentfault.com/a/1190000010984731
轉(zhuǎn)載于:https://www.cnblogs.com/ZCrystal/p/10490781.html
總結(jié)
以上是生活随笔為你收集整理的VSCode 启动 Vue 项目 npm install 报错的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 需要支持多种操作的线段树该如何确定运算顺
- 下一篇: vue项目中开启Eslint碰到的一些问