Skip to content Skip to sidebar Skip to footer

How To Solve 'cannot Find Module 'webpack-cli/bin/config-yargs' Error In Reactjs?

When I run my first hello world react example, I got the following error. How do I solve this? Error: Cannot find module 'webpack-cli/bin/config-yargs' at Function.Module._reso

Solution 1:

2021 - the error is again actual. After upgrade to webpack 5 just replace the

 webpack-dev-server --...

to same code command with

webpack serve --...

Solution 2:

The error is telling you that you don't have webpack-cli installed. You can install it and add it to your dev dependencies.

npm i -D webpack-cli

You also have a new version of Webpack installed with an outdated configuration object. If you change configuration.module.loaders to configuration.module.rules it will work.

Solution 3:

The reason was the versions of these libraries : — webpack , webpack-cli and webpack-dev-server. I fount out that the versions I used couldn’t work together. So I reinstall them and used the older versions which are:

  1. "webpack": "^4.32.2",
  2. "webpack-cli": "^3.3.2",
  3. "webpack-dev-server": "3.5.1"

Post a Comment for "How To Solve 'cannot Find Module 'webpack-cli/bin/config-yargs' Error In Reactjs?"