banli17 / note

学习记录
https://banli17.github.io/note/docs/intro
MIT License
17 stars 2 forks source link

vue2.0环境配置问题,报错等 #121

Open banli17 opened 2 years ago

banli17 commented 2 years ago

Error: Rule can only have one resource source (provided resource and test + include + exclude) in {

项目莫名报错。没有修改 package.json 和 lock.json ,不清楚为什么就升级了,之前 webpack 是 4.46.0 升级成了 5.x

解决方法: 重新拷贝之前的 package.-lock 和 package.json 文件,重新安装依赖

原因 某些新版本的库要求 webpack@5,更新依赖时,根据依赖选择的规则,就以 webpack@5 作为主依赖安装。然而 @vue/cli 依赖 webpack@4,它自带的 webpack 配置无法兼容 webpack@5 ,于是就报错,不能继续编译。如果你也在使用 @vue/cli,那么请不要贸然升级 webpack@5。

https://blog.meathill.com/fe-tool-chain/how-to-fix-error-rule-can-only-have-one-resource-source-provided-resource-and-test-include-exclude.html

banli17 commented 2 years ago

Error: Cannot find module 'webpack/lib/rules/DescriptionDataMatcherRulePlugin' Require stack

You need to update your vue-loader

npm update vue-loader

And if it is not installed, install it

npm i vue-loader

https://stackoverflow.com/questions/69631437/error-cannot-find-module-webpack-lib-rules-descriptiondatamatcherruleplugin-r