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