1. Use [email protected] When I execute webpack dev server through script
of package.json
, I report the following error:
Error: Cannot find module 'webpack/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
......
Reason: This is the current version [email protected] I won’t support it [email protected]
Solution: re install a webpack dev server, which is compatible with version 3.0 or above
1 | npm i [email protected] -D |
At this point, you can… If you still report an error, refer to the last one
2. Webpack cli must be installed for webpack4.0 or above. Otherwise, an error is reported as follows:
Error: Cannot find module 'webpack-cli/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
At this time, you need to install webpack cli:
npm i webpack-cli -D
3. In this way, an error may be reported after the installation. At this time, you need to uninstall all the webpack cli webpack dev servers
Re install together, be sure to remember, install together at the same time
npm i webpack webpack-cli webpack-dev-server -D
My installation is as follows:
Similar Posts:
- Cannot findmodule’webpack-cli/bin/config-yargs
- Webpack packaging error: cannot find module ‘webpack / bin / config yargs’ error reason, [email protected] Step on the pit~
- [Solved] Module build failed: Error: Cannot find module ‘node-sass’
- [Solved] Webpack Error: [webpack-cli] Unable to load ‘@webpack-cli/serve’ command
- Causes and solutions of error reporting in require setting dynamic path
- WebPack Task Runner
- Webpack introduces HTML webpack plugin and reports an error
- Webpack high version pulls out CSS style and reports an error [Solved]
- Solutions to the problem that image webpack loader cannot be installed or the installation is stuck
- [Solved] Vue installs less Error: Failed to compile with 1 errors