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

The following error occurred while running NPM Run Dev:

Error: Cannot find module 'webpack/bin/config-yargs'
Require stack:
- D:\javaProject\vue\myvue\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (D:\javaProject\vue\myvue\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\javaProject\\vue\\myvue\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Wenxindiao\AppData\Roaming\npm-cache\_logs\2020-04-22T03_06_48_257Z-debug.log

Solution:
this is because the current version of [email protected] does not support [email protected] So simply delete the current Webpack-dev-Server folder and reinstall the higher version. The steps are as follows:

    find the project folder you created, mine is D:\javaProject\vue\myvue\node_modules\webpack-dev-server, delete the webpack-dev-server folder. Run NPM I [email protected] in the current project directory, and your webpack-dev-server version will be fine. Or update directly to the latest version
npm i –-save-dev [email protected] 

Read More: