svelte-preprocess
svelte-preprocess copied to clipboard
Conflicting peer dependency with postcss-mixins (sugarss)
Describe the bug
Unable to add postcss-mixins
to a svelte project.
Logs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/sugarss
npm ERR! sugarss@"^4.0.1" from [email protected]
npm ERR! node_modules/postcss-mixins
npm ERR! dev postcss-mixins@"^9.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional sugarss@"^2.0.0" from [email protected]
npm ERR! node_modules/svelte-preprocess
npm ERR! dev svelte-preprocess@"^4.10.1" from the root project
npm ERR! svelte-preprocess@"^4.0.0" from [email protected]
npm ERR! node_modules/svelte-check
npm ERR! dev svelte-check@"^2.2.6" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/sugarss
npm ERR! peerOptional sugarss@"^2.0.0" from [email protected]
npm ERR! node_modules/svelte-preprocess
npm ERR! dev svelte-preprocess@"^4.10.1" from the root project
npm ERR! svelte-preprocess@"^4.0.0" from [email protected]
npm ERR! node_modules/svelte-check
npm ERR! dev svelte-check@"^2.2.6" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
To Reproduce
-
npm i postcss-mixins -D
in a project withsvelte-preprocess
Expected behavior Install without a problem.
Information about your project
- Your operating system: Windows 10
-
svelte-preprocess
version: 4.10.6 - Project uses SvelteKit
Possible solution
Update sugarss
to ^4.0.1
.
We should probably relax the peer dep to be "anything higher than 2", assuming they didn't change anything that we use (haven't checked).
I'm wondering if we should get rid of the peer dependencies altogether. Since npm 7 they are all installed automatically which is way too much for the average user.
@dummdidumm hmm, didn't know they were being installed automatically since npm 7. In that case I agree 100% with you, but we need to find a way to tell what a user should install to use a certain preprocessor. Do you think that documentation is enough in this case?
@kaisermann I think it’s safe to assume that a user at least read the documentation of the preprocessor he wants to use. That should hopefully already cover all the installation instructions. Although I think some documentation here would also be nice. Anyway package.json
is the last place I would look for the these instructions...
Is there any update on this issue ? Meanwhile I am using npm install with flag --legacy-peer-deps to hide the conflict errror.
I'm not able to deploy to cloudflare due to this. Any idea of a workaround?
Also running into this issue, is there a possible short term fix while we figure out the right answer long term?
I also think this is a bug in NPM tbh. sugarss@4
is not a peerDep of postcss-mixins
, it's a dep
. If there were a conflict, shouldn't each package get there own version instead of sharing one in that case? Seems like an issue with peer deps being resolved/applied after normal deps are installed.
Totally on board to bump peer dep as @dummdidumm proposed. Postcss-mixins is a pretty popular package.
I'm a bit distant from this issue, and I'm still unsure about removing all peer deps, but we can add the new postcss version as a peer dep too. Would that be enough to support postcss-mixins
?
This will be included in #562