解決npm下載出錯問題

由於一開始沒有聯網,後來連好網,再輸入命令就出現下面錯誤。

F:\web\node\node_code\express>npm install express
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "express" under a package
npm ERR! also called "express". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR!     <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\windows\AppData\Roaming\npm-cache\_logs\2020-04-18T13_57_20_466Z-debug.log

原因:
舊的npm緩存與項目衝突

解決方法:(親測有效)
步驟一

sudo npm cache clean

步驟二

npm config set registry https://registry.npm.taobao.org

注:有時我們使用npm下載資源會很慢,所以我們可以安裝一個cnmp(淘寶鏡像)來加快下載 速度。

我是樂樂呀,感謝您的閱讀。如果您覺得不錯,那就點個贊吧,您的支持是我最大的動力。謝謝😜

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章