svelte-preprocess icon indicating copy to clipboard operation
svelte-preprocess copied to clipboard

Conflicting peer dependency with postcss-mixins (sugarss)

Open Azarattum opened this issue 2 years ago • 5 comments

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 with svelte-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.

Azarattum avatar Apr 28 '22 06:04 Azarattum

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 avatar Apr 28 '22 09:04 dummdidumm

@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 avatar Apr 28 '22 16:04 kaisermann

@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...

Azarattum avatar Apr 28 '22 16:04 Azarattum

Is there any update on this issue ? Meanwhile I am using npm install with flag --legacy-peer-deps to hide the conflict errror.

peter-75 avatar Jun 13 '22 15:06 peter-75

I'm not able to deploy to cloudflare due to this. Any idea of a workaround?

fev4 avatar Aug 17 '22 05:08 fev4

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.

pzuraq avatar Sep 23 '22 17:09 pzuraq

Totally on board to bump peer dep as @dummdidumm proposed. Postcss-mixins is a pretty popular package.

sebmor avatar Nov 09 '22 23:11 sebmor

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?

kaisermann avatar Nov 10 '22 09:11 kaisermann

This will be included in #562

kaisermann avatar Dec 10 '22 14:12 kaisermann