The bottom line is that if the name in package.json is the same as the package you are trying to install, you will get an error.
Terminal
 npm install --save-dev webpack
I got an error.
The details of the error are as follows.
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>
From the part of also called" webpack "・ ・ ・ on the 3rd line of the error, it was found that there is a package name with the same name.
package.json
{
  "name": "webpack",← This is webpack
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
You can safely resolve the error by rewriting the name as webpackdemo.
Recommended Posts