前端webpack安装版本不兼容问题
出现错误:
Error: Cannot find module ‘webpack-cli/bin/config-yargs’
解决方案:找到兼容的webpack,webpack-cli,webpack-dev-server版本
“webpack”: “^5.1.3”,
“webpack-cli”: “^4.1.0”,
“webpack-dev-server”: “^3.11.0”
接下来我们来说一下要执行的命令:
1.删除之前下载的webpack,webpack-cli,webpack-dev-server
npm uninstall webpack
npm uninstall webpack-cli
npm uninstall webpack-dev-server
npm uninstall webpack
npm uninstall webpack-cli
npm uninstall webpack-dev-server
2.接下来我们下载对应版本webpack,webpack-cli,webpack-dev-server
npm install webpack@5.1.3
npm install webpack-cli@4.1.0
npm install webpack-dev-server@3.11.0
当你看到了这个页面,恭喜你已经成功了,给自己一个掌声!!!
转载:http://www.mamicode.com/info-detail-3086761.html