在安装webpack时出现错误
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
原因是在初始化项目pack.json的时候npm init -y 默认把名字设置为webpack(因为我一开始新建的文件夹名字就是webpack,所以它在package.json中name属性就是webpack)
导致和安装webpack包的的名字一样,所以报错
解决办法:
将pack.json的name属性换成除webpack的其他名字