【webpack-dev-server】Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
程序员文章站
2022-07-12 19:34:36
...
经查阅资料解决办法,发现是因为webpack-cli版本与webpack-dev-server不兼容
报错时,我的webpack-cli是 4.*,而"webpack-dev-server":为"^3.11.1"
解决办法:
将webpack-cli版本降级为 3.*即可
方法如下:
- 第一种
将package.json改写
"webpack-cli": "^3.3.12"
再执行
npm install
- 第二种
卸载之前的版本,再重新安装旧版本也是可以的
npm i webpack-[email protected]3.3.12 -D
推荐阅读
-
【已解决】运行webpack-dev-server时提示Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
webpack5: Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
Webpack 报错:Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
webpack-dev-server 报错 Error: Cannot find module ‘webpack/bin/config-yargs‘
-
webpack——Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
【webpack-dev-server】Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
Error: Cannot find module 'webpack-cli/bin/config-yargs' at Function.Module._resolveFilename
-
【webpack】Error: Cannot find module webpack-cli/bin/config-yargs
-
Error: Cannot find module ‘webpack-cli/package.json‘
-
Error: Cannot find module ‘webpack-cli/package.json‘