webpack packaging error Error: Cannot find module'webpack/bin/config-yargs' error reason, webpack@5.X.X stepped on the pit~

created at 10-29-2021 views: 3

error

Create a new project, and webpack reports an error when the project starts. The error is as follows: 

cannot find module'webpack/bin/config-yargs'

The version number of my local webpack is 5

I searched a lot of methods on the Internet, almost all of them uninstalled all webpack webpack-cli webpack-dev-server, but they were still unsuccessful.

package.json

reason

This is the current version of webpack-dev-server@2.11.5 does not support webpack@5.60.0

Then reduce the version number of webpack.

The version of webpack can be installed as 3xxx.

Summary

As long as the version of webpack-cli and webpack-dev-server is 3.x.x, it can be solved, the version of webpack is greater than 4.x.x.x does not support

created at:10-29-2021
edited at: 10-29-2021: