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
image

解决方案:

  1. 卸载 webpack-cli:npm uninstall webpack-cli
  2. 安装 webpack-cli 3.* 版本: npm install webpack-cli@3 -D
posted @ 2021-06-19 14:14  曾经的点工  阅读(165)  评论(0编辑  收藏  举报