1. 程式人生 > >npm安裝報錯npm ERR! Refusing to install package with name "xxxx" under a packagexxxx

npm安裝報錯npm ERR! Refusing to install package with name "xxxx" under a packagexxxx

錯誤資訊

npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "webpack" under a package
npm ERR! also called "webpack". 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\wo\AppData\Roaming\npm-cache\_logs\2018-11-19T09_18_33_619Z-debug.log

錯誤的ERR! 程式碼ENOSELF
錯誤的ERR! 拒絕在包下安裝名為“webpack”的包
錯誤的ERR! 也被稱為“webpack”。 你的專案名稱是否相同?
錯誤的ERR! 作為您正在安裝的依賴項?
錯誤的ERR!
錯誤的ERR! 有關更多資訊,請參閱:
錯誤的ERR!<https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>

錯誤的ERR! 可以在以下位置找到此執行的完整日誌:

解決方法

檢查package.json下的name欄位是不是專案名字和你安裝的那個包名字相同了,如果一樣就會報那個錯,把專案名字改成和你安裝不衝突的名字