关于requires a peer of webpack@^3.1.0 but webpack@4.41.2 was installed
解决方法:
我使用淘宝镜像cnpm install安装依赖成功后执行npm run build时报错:
Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead.
我发现在cnpm install 时有警告:requires a peer of webpack@^3.1.0 but webpack@4.41.2 was installed,可以看出webpack版本有問題,就是我項目要求使用webpack@^3.1.0但下载的是webpack@4.41.2
所以我先把所有依赖删除:
rm -rf node_modules
rm -rf package-lock.json
npm cache clear --force
cpm cache clear --force
先执行cnpm install webpack@^3.1.0安装webpack,再执行cnpm install,之后再运行npm run build不报错了
向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti