webpack筆記_(2)_Refusing to install webpack as a dependency of itself


安裝webpack時,出現以下問題:

Refusing to install webpack as a dependency of itself

 

 1 npm ERR! Windows_NT 10.0.14393
 2 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "webpack" "--save-dev"
 3 npm ERR! node v7.1.0
 4 npm ERR! npm v3.10.9
 5 npm ERR! code ENOSELF
 6 
 7 npm ERR! Refusing to install webpack as a dependency of itself
 8 npm ERR!
 9 npm ERR! If you need help, you may report this error at:
10 npm ERR! <https://github.com/npm/npm/issues>
11 
12 npm ERR! Please include the following file with any support request:
13 npm ERR! F:\ProgramWork\React\React_Note\WebReact\webpack_react\npm-debug.log

 

原因是:不能安裝webpack到自身目錄。

 

解決方案:

      1.如果本次安裝的目錄下沒有 package.json 文件。

         直接修改本次安裝的目錄。確保目錄中沒有同名的“webpack”文件路徑。

      2.如果目錄中包含 package.json 

         修改1中的內容外。需要修改package.json中的 “name”字段的值:

         如 "name": "webpackProject",不能設定為: "name": "webpack"。


免責聲明!

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



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