Open vpasquier opened 3 years ago
Thanks for submitting this issue! Due to our limited time, we ask you to include a reproduction link to a minimal full reproduction of your problem (for example in a GitHub repository) so we can find what is causing the issue. Thank you for your understanding!
I will create a repository with this very simple package.json - as you can see, its with the default behavior of the vue cli... nothing customized at all.
Here is the project example (sorry its dirty but simple) - https://github.com/vpasquier/vuejscli-repro
The problem is related to webpack 5 (https://github.com/vpasquier/vuejscli-repro/blob/master/my-project/package.json#L20)
This is the only thing i've added as dependency from the default vuejs bootstrap. I've reverted my project to 4.x.x and it works well. They have released recently.
Just confirmed this with an actual project. It works with Webpack 4.44.2 but fails with anything 5.x.x
Is downgrading to Webpack 4.x.x a good solution?
I have exactly the same problem
I had the same issues using Node version 15, downgrading to Node version 14 LTS worked for me.
Hope this helps :)
Having the same issue, moving from Node version 15 to 14 didn't work for me. Here is the exception I am getting
Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
"exclude": [
null
],
"use": [
{
"loader": "~/node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js",
"options": {
"cacheDirectory": "~/node_modules/.cache/babel-loader",
"cacheIdentifier": "a8ec5012"
},
"ident": "clonedRuleSet-38[0].rules[0].use[0]"
},
{
"loader": "~/node_modules/babel-loader/lib/index.js",
"options": "undefined",
"ident": "undefined"
}
]
}
at checkResourceSource (~/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:167:11)
at Function.normalizeRule (~/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:198:4)
at ~/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:110:20
at Array.map (<anonymous>)
at Function.normalizeRules (~/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:109:17)
at new RuleSet (~/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:104:24)
at new NormalModuleFactory (~/node_modules/@vue/cli-service/node_modules/webpack/lib/NormalModuleFactory.js:115:18)
at Compiler.createNormalModuleFactory (~/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:636:31)
at Compiler.newCompilationParams (~/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:653:30)
at Compiler.compile (~/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:661:23)
at ~/node_modules/@vue/cli-service/node_modules/webpack/lib/Watching.js:77:18
at AsyncSeriesHook.eval [as callAsync] (eval at create (~/node_modules/@vue/cli-service/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
at AsyncSeriesHook.lazyCompileHook (~/node_modules/@vue/cli-service/node_modules/tapable/lib/Hook.js:154:20)
at Watching._go (~/node_modules/@vue/cli-service/node_modules/webpack/lib/Watching.js:41:32)
at ~/node_modules/@vue/cli-service/node_modules/webpack/lib/Watching.js:33:9
at Compiler.readRecords (~/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:529:11)
Itβs not a node version issue but a webpack v5 issue
Did anybody find a workaround?
I found a solution but in my case I believe it was somewhat related to the Quasar Framework dependencies my project was using. But here are some steps that helped me out:
I started using Node v12 (which is recommended by many frameworks as it is the last LTS version released) and forced the project to use "core-js" dependency in version 3, I've also seen some folks saying that version 2 also worked for them, but for me it only worked on 3.
I discovered that my problem specifically was related to the Quasar Framework getting updated to v2, and that there are plenty of modifications one has to do to make the project work correctly. If you are using Quasar, I highly recommend you to check this version upgrade tutorial: https://quasar.dev/quasar-cli/app-upgrade-guide
I can confirm that downgrading to "webpack": "^4.45.0"
works
4.46.0 doesn't work. I get the same error again. Thanks @MichaelSp. Looks like that's the barrier for this version.
Is downgrading to Webpack 4.x.x a good solution?
Worked for me!
But Vue should support Webpack 5.x or at least provide instructions on how to configure Webpack 5.x
This error raises by combination of @vue/cli-plugin-babel
and vue-loader
's plugin-webpack5.js
.
webpack 5 looks reject combining test
/ include
/ exclude
with resource
, and plugin-webpack5.js
always add default resource
function.
This error raises by combination of
@vue/cli-plugin-babel
andvue-loader
'splugin-webpack5.js
. webpack 5 looks reject combiningtest
/include
/exclude
withresource
, andplugin-webpack5.js
always add defaultresource
function.
So,how to solve this issue if I really want to use webpack 5?
For me this issue appeared after updating my sass-loader
. Fixed by downgrading to "sass-loader": "^10.1.1"
all solution above not works for me.
Mine is the monorepo repository. After webpack (4/5) is referenced in a package, the CLI cannot be started, and these two packages must be deleted.
At first I thought it was a webpack 5 problem until I switched back to webpack 4, the problem still existed.
For me, vue-cli is really a black box
I guess that's because vue-loader/plugin-webpack5 is using 'resource/resourceQuery' but cli-plugin-babel 'exclude' on the same (.m?jsx?) rule. @sodatea: Could vue-loader and cli-plugin-babel use a common interface or should they create two rules?
totally the same err, I've no idea how to fix it
Could you provide a reproduction repo, please? Because I cannot reproduce this error on my local projects.
This error raises by combination of
@vue/cli-plugin-babel
andvue-loader
'splugin-webpack5.js
. webpack 5 looks reject combiningtest
/include
/exclude
withresource
, andplugin-webpack5.js
always add defaultresource
function.
It seems this issue occurs when webpack5 uses thevue-loader-v15/lib/plugin-webpack4.js
I can reproduce the issue by this way, by the way, I am using npm@6
npx @vue/cli create test_project --packageManager npm # (select vue2, babel/eslint-plugin)
npm i @vue/cli-service@5.0.0-alpha.6 -D
npm run serve
directory tree
node_modules
ββββwebpack@4 (dependeny of @vue/vue-cli-plugin-babel and @vue/cli-plugin-eslint
ββββ@vue/cli-service
β ββββwebpack@5
ββββvue-loader-v15
maybe webpack
should be listed in peerDependencies
in @vue/cli-plugin-*
. Also can fix in vue-loader-v15/lib/plugin-webpack4.js
@sodatea
There's already a peer dependency requirement from the cli plugin: https://github.com/vuejs/vue-cli/blob/9ea68a8a46ec28a78f94b25e92fb5075dc70af10/packages/%40vue/cli-plugin-babel/package.json#L31-L33
je veux migrer du version 4 Γ 5 , donc la solution proposer au dessus ne me convient pas, y a t il une autre solution ?
Just confirmed this with an actual project. It works with Webpack 4.44.2 but fails with anything 5.x.x
am... This did not work for me...
My situation is to use the monorepo repository
.
βββ Dockerfile.docs
βββ JenkinsShellDocs.sh
βββ LICENSE
βββ README.md
βββ commitlint.config.js
βββ docs
βΒ Β βββ README.md
βΒ Β βββ _404.md
βΒ Β βββ _coverpage.md
βΒ Β βββ _navbar.md
βΒ Β βββ _sidebar.md
βΒ Β βββ design
βΒ Β βββ development
βΒ Β βββ development.md
βΒ Β βββ files.md
βΒ Β βββ files_template_uni_app.md
βΒ Β βββ files_template_vue2.md
βΒ Β βββ files_template_vue3.md
βΒ Β βββ index.html
βΒ Β βββ publish
βΒ Β βββ quick-start.md
βΒ Β βββ standard
βΒ Β βββ strut.md
βββ lerna.json
βββ nginx.conf
βββ package.json
βββ packages
βΒ Β βββ create-app
βΒ Β βββ http-client
βΒ Β βββ inner-css
βΒ Β βββ swagger-ts
βΒ Β βββ utils
βΒ Β βββ vue2-component
βββ script
βΒ Β βββ staged-lint
βΒ Β βββ workspace-cmd
βββ tsconfig.base.json
βββ vetur.config.js
βββ yarn.lock
create-app
have vue-cli@4
deps
vue2-component
has webpack@5
deps. The node_modules between them are independent(DID NOT SHARE node_modules). So they should not affect each other.
But when I tried it, when I lowered webpack@5 to webpack@4, everything was back to normal again.
4.46.0 doesn't work. I get the same error again. Thanks @MichaelSp. Looks like that's the barrier for this version.
solved problem in this way, thx
For what it's worth, I was having the same issue. Latest npm 7 handles peer dependencies in a different way than npm 6.
Following some advice in https://github.com/nuxt/nuxt.js/issues/8277 I ran npm i --legacy-peer-deps
which drops webpack 5 from my package-lock.json
and the build now works as expected.
Dialing it back to "sass-loader": "^10.1.1"
in package.json
worked for me. I appear to be on webpack@4.46.0
already.
I had the same issue: npm rebuild node-sass
made the job !
It can be resolved with the following commands
npm uninstall sass-loader
npm install sass-loader@^10.1.1 --save-dev
If the version of webpack is 5 then downgrade to any version between 4 and 5
npm uninstall webpack
npm install webpack@^4.0.0 --save-dev
It can be resolved with the following commands
npm uninstall sass-loader
npm install sass-loader@^10.1.1 --save-dev
If the version of webpack is 5 then downgrade to any version between 4 and 5npm uninstall webpack
npm install webpack@^4.0.0 --save-dev
This worked well for me on vue3 and TypeScript setup
rm -rf node_modules
npm install webpack@^4.0.0 --save-dev
npm i
fix error~
I use stylus and not sass and have the same problem. I found that it occurs when I use stylus-loader v5.0.0 or greater. I submitted an issue in their repo https://github.com/webpack-contrib/stylus-loader/issues/320
Geez, is this issue really this old? π±
I found that source-map-loader 2.0+ also requires webpack 5 which was mentioned earlier that it has to be downgraded to fix this issue. Use "source-map-loader": "1.1.3"
in this case
This is getting ridiculous. I also have this problem. I just reverted old packege-lock.json and it works.
Why It was possible to properly install dependencies few weeks ago and now it is not possible? I even did't change anything!
It's insane how fragile our dependencies are.
WARN webpack@5.47.1 is installed but ^4.46.0 is expected
WARN sass-loader@12.1.0 is installed but ^10.1.1 is expected
Uninstalling webpack and sass-loader then installing the mentioned versions was enough for me
Hello I have a problem. I removed the node_modules folder and package-lock.json file. I ran npm uninstall webpack
then npm install webpack@^4.0.0 --save-dev
but i get this error :
In my case the issue was with the cache-loader that couldn't work along webpack v5 and vue/cli v4.x requires cache-loader. vue/cli v5 moved to webpack 5 and vue/cli v5.0.0-beta.3 dropped requirement for cache-loader. So updating both webpack and vue/cli to v5 solved the issue. Now everything is working fine.
It can be resolved with the following commands
npm uninstall sass-loader
npm install sass-loader@^10.1.1 --save-dev
If the version of webpack is 5 then downgrade to any version between 4 and 5npm uninstall webpack
npm install webpack@^4.0.0 --save-dev
This worked for me. Thank you
I also observe that errors occur with the mentioned dependencies. However, when i use yarn instead of npm, the project works fine... there is something about yarn that seems to be just better...
I also have this issue in a laravel-mix powered vue project. Getting all kinds of dependency errors and it looks like laravel-mix is doing something.
This is getting ridiculous. I also have this problem. I just reverted old packege-lock.json and it works.
Why It was possible to properly install dependencies few weeks ago and now it is not possible? I even did't change anything!
It's insane how fragile our dependencies are.
Totally agree with @zawadsoon. It is incredible how we are overexposed to dependencies. From a project up and running to a project full of unknown errors due to 3rd party libs.
None of those actually worked for me.
Updating vue/cli* to >= 5.0.0-rc.1 solves this issue can i can now use webpack 5 and sass-loader > 10.2 The alternative is to downgrade to webpack 4 and sass-loader 10.2 Thanks, syldman.
Just in case anyone has the issue I had with this, I thought I would share.
Basically for me, the problem was due to one package I was using having a dependancy on css-loader, which since version 6, has moved to using webpack 5. I suspect this will keep happening while packages update to using webpack 5, so it may be a different package for you.
I could see the problem when trying to add webpack 4.46.0 as a dev dependancy npm i webpack@4.46.0 --save-dev
I then checked the version css-loader switch to using webpack 5 and then included the version before as a dev dependancy. npm i css-loader@5.2.7 --save-dev
. I could then also include webpack 4 as a dev depenadancy and everything was working again.
What a nightmare!! Hope that helps someone!!
Can people stop posting the "solution" of not using webpack 5? It's not that new anymore, and many packages require it.
Vue needs to support this.
npm uninstall webpack npm install webpack@^4.0.0 --save-dev
npm uninstall webpack npm install webpack@^4.0.0 --save-dev
This doesn't solve the described issue, is only a bandaid
Any update on this front without degrading webpack?
Version
4.5.8
Environment info
Steps to reproduce
npm install
vue-cli-service build
orvue-cli-service serve
What is expected?
To be built correctly
What is actually happening?
Error occurs: