Cannot find module ‘webpack/bin/config-yargs’

If you’re using webpack-cli 4 or webpack 5, change webpack-dev-server to webpack serve.

Example:

"serve": "webpack serve --config config/webpack.dev.js --progress"

You might want also check this comment on GitHub:

NPM package.json scripts are a convenient and useful means to run
locally installed binaries without having to be concerned about their
full paths. Simply define a script as such:

For webpack-cli 3.x:

"scripts": {   "start:dev": "webpack-dev-server" }

For webpack-cli 4.x:

"scripts": {   "start:dev": "webpack serve" }

Leave a Comment