Solved – problem cannot find module ‘webpack / bin / config yargs’

1. The question is:

    throw err;

Error: Cannot find module 'webpack/bin/config-yargs'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\saic\dev\expressVue\node_modules\[email protected]@webpack-dev-server\bin\webpack-dev-server.js:54:1)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

Reason 2.
The above error occurs when webpack does not match the webpack-dev-server version. The specific version is as follows:
“Webpack” : “^ 4.35.0,”
“webpack – cli” : “^ 3.3.5”,
“webpack – dev – server” : “^ 2.11.5”
Webpack-dev-server should be used in pairs with Webpack, with versions 2.2.0 to 3.0.0 for 2.11.5 of Webpack.
Webpack is version 4.35.0 in this project, which is ahead of webpack-dev-server, so you should upgrade webpack-dev-server.
3. Solutions
3.1 Uninstall the old package and then upgrade

cnpm uninstall --save-dev webpack-dev-server

cnpm install --save-dev [email protected]

It is also possible to replace CNPM with NPM.
3.2 Modify package.json and then CNPM install or NPM install
The method for root 3.1 is essentially the same

Read More: