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

To fix it just do 2 things.

  1. Install npm i webpack-cli @webpack-cli/init
  2. Add this to your package.json:
    "scripts": {
      "start": "webpack-cli serve --mode development"
    },
    

Done!


You could try changing webpack-dev-server to webpack serve in your npm run script inside package.json


For some reason the webpack team changed the command to webpack serve Change your package.json:

"start": "webpack serve"

Ref: https://github.com/webpack/webpack-dev-server/issues/2759

The version I am using:

"webpack": "^5.10.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"