THE・雑記

ゲームのことだったりITについてだったり記していきます

npm install のエラーで Refusing to install package with name が出た

 npmでモジュールをインストールしようとしてた時に出たエラー。

npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/xxxxxx/.nvm/versions/node/v8.2.1/bin/node" "/Users/xxxxxx/.nvm/versions/node/v8.2.1/bin/npm" "install" "electron"
npm ERR! node v8.2.1
npm ERR! npm  v4.0.5
npm ERR! code ENOSELF

npm ERR! Refusing to install package with name "electron" under a package
npm ERR! also called "electron". 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!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/xxxxxxx/git/electron/npm-debug.log

 

npmのキャッシュを削除してみたりとか色々試してたけどうまくいかず。

 

よーくエラーを読んでみるとDid you name your project the same で気がつかなきゃいけなかったです。

 

端的に言うとモジュール名と同じ名前のプロジェクト名をつけるとダメみたいです。

 

エラーが出ている人はpackage.jsonの中のnameがインストールしようとしているモジュールと同じ名前ではないでしょうか?

 

さっさとプロジェクト名を変えてインストールしてしまいましょう。

ろくにエラーを読まずに色々試しちゃダメでしたね。反省。