Error: Cannot find module ‘webpack-cli/bin/config-yargs

Error: Cannot find module ‘webpack-cli/bin/config-yargs_第1张图片
显示是“找不到webpack-cli下的yargs配置”
当前开发依赖版本为:

 "devDependencies": {
    "webpack": "^5.36.2",
    "webpack-cli": "^4.7.0",
    "webpack-dev-server": "^3.11.2"
  }

webpack-cli早在4.0版本后就移除了yargs,于是将webpack-cli还原到3.3.12版本的版本
手动修改版本

 "devDependencies": {
    "webpack": "^5.36.2",
    "webpack-cli": "^3.11.2",
    "webpack-dev-server": "^3.11.2"
  }

继续安装

PS C:\Users\Administrator\Desktop\QY133_ready\12、webpack\webpack2> npm install webpack-cli@3

命令中的@3,表示安装3.几的版本,安装后再来运行,即可正常使用

你可能感兴趣的:(WEB板块,常见问题,陈福国,陈福国web,陈福国webpack,webpack报错)