Webpack dependent package installation problem solution: Refusing to install package with name "webpack" under a packageebpack

When installing webpack, the following error will be reported

Insert picture description hereEnglish translation:

1. Refuse to install the package named "webpack" (also known as "webpack")
2. Also known as "webpack". Did you name the project the same name as the dependencies being installed?

Analyze the reasons:

The reason is that when initializing the project package.json, npm init -y sets the name to webpack by default, resulting in the same name as the webpack dependent package installation, so the error Insert picture description here
solution is:

It can be solved by replacing the name attribute of package.json with a name other than webpack

Insert picture description here

Successful installation!

Insert picture description here

Published 28 original articles · praised 7 · views 1168

Guess you like

Origin blog.csdn.net/haduwi/article/details/105599083