首页 > 其他分享> > internal/modules/cjs/loader.js:968 throw err; ^ Error: Cannot find module ‘webpack-cli/bin/conf
internal/modules/cjs/loader.js:968 throw err; ^ Error: Cannot find module ‘webpack-cli/bin/conf
作者:互联网
webpack的devServer运行错误
npx webpack-dev-server
翻车现场
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module ‘webpack-cli/bin/config-yargs’
Require stack:
…
…
…
问题原因
webpack-dev-server和webpack-cli有版本对应问题,我使用的版本如下:
解决方案
1、运行命令卸载webpack-cli
npm uninstall webpack-cli
如果报错,就从package.json中手动删除webpack-cli项(如下图),然后删除掉node_modules文件夹,运行cnpm install
重新安装依赖
2、安装低版本webpack-cli
cnpm install webpack-cli@3 -D
安装成功后问题就解决了
标签:bin,cli,err,968,modules,dev,server,webpack 来源: https://blog.csdn.net/Kindergarten_Sir/article/details/110352897