解決npm ERR!


 

一:[Unexpected end of JSON input while parsing near]報錯

最近的vue項目中在執行 npm install 時會報錯誤:

npm ERR! Unexpected end of JSON input while parsing near

 

這個錯誤的解決方法有以下幾種:

1.刪掉package.lock.json

2.清除cache

npm cache clean --force

 

3.進入下面這個文件夾清除cache
路徑:C:Users PCAppDataRoamingnpm-cache
執行:

npm cache clean --force

 

4.不要用淘寶鏡像。

npm set registry https://registry.npmjs.org/

 

參考資料:https://github.com/vuejs-temp...

 


 

二:A complete log of this run can be found in 報錯

最近的vue項目中在執行 npm install 時會報錯誤:
通過“A complete log of this run can be found in”發現,原來是npm版本的問題,然后更新了npm版本,然后再裝腳手架,就搞定了。

全局更新

npm install npm -g 

 

或者用淘寶鏡像命令

cnpm install npm -g

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM