webpack打包报错 Cannot find module 'webpack-cli/bin/config-yargs'
- 查看package.json文件
// package.json
"devDependencies": {
"webpack": "^5.2.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
}
在 github 上找到问题:
https://github.com/webpack/webpack-cli/issues
解决方案:
- 卸载 webpack-cli:
npm uninstall webpack-cli
- 安装 webpack-cli 3.* 版本:
npm install webpack-cli@3 -D