Error: Cannot find module ‘webpack-cli/bin/config-yargs’

CY
Oct 12, 2020

I set up a React project by using webpack, but after setup when I ran the code webpack-dev-server --mode=development the app couldn’t work properly and throw the error: Error: Cannot find module 'webpack-cli/bin/config-yargs' .

After googling for a while, I found out the reason was the versions of these libraries — webpack , webpack-cli and webpack-dev-server — I used couldn’t work together. So I reinstall them and used the older versions which are:

"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.5.1"

And now my setup works as well as expected.

--

--