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

NPM run dev</code bbb>ror: Cannot find module 'webpack-cli/bin/config-yargs'

// current package.json file
"devDependencies": {
    "webpack": "^5.2.0",
    "webpack-cli": "^4.1.0",
    "webpack-dev-server": "^3.11.0"

Question Quote:

refer to: Error: Cannot find module 'webpack-cli/bin/config-yargs' #1948

If you upgrade webpack to 5. *, and webpack cli to 4. *, an error will be reported:

Error: Cannot find module 'webpack-cli/bin/config-yargs'
Temporary solution: Back off webpack cli to version 3. * for example:

"webpack-cli": "^ 3.3.12"

NPM install [email protected] -d </code bbb>/ ol> <>ode>

Webpack-dev-server ^3 requires webpack-cli ^3 installation

// package.json file
"devDependencies": {
    "webpack": "^5.2.0",
    "webpack-cli": "^3.3.12",
    "webpack-dev-server": "^3.11.0"

Think about:
If you encounter a problem, go to the Issues section of the GitHub project first and retrieve the related problem. It is much better than directly searching for unofficial solutions on Google.
Please feel free to reprint the original article. Wish to share with you and make progress together. – jiang coder

Read More: