davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
6.02k stars 180 forks source link

Won't install on React 17 #362

Closed boris61 closed 2 years ago

boris61 commented 2 years ago

Bug is related to

Embla Carousel version

Describe the bug

Additional context

th-km commented 2 years ago

@boris61 This is not a bug, you need to run npm install embla-carousel-react --legacy-peer-deps as mentioned in your log.

boris61 commented 2 years ago

Thanks. Closing the issue.

boris61 commented 2 years ago

Reopening for a question. Installing with --legacy-peer-deps was fine and everything worked afterwards, but I still fail to see how this is not an issue. I won't ask every member of our team to install it manually, our package.json changes regularly. So the only way is to add legacy-peer-deps=true to .npmrc and that's a global project flag and not a good solution. So save for that and actually upgrading to React 18.1.0,, am I missing some other workaround?

davidjerleke commented 2 years ago

Hi @boris61,

Thank you for your question.

I still fail to see how this is not an issue

To be honest, I fail to see why this would be a problem specific to embla-carousel-react? This StackOverflow thread explains why this is happening so please take some time to read it. And I'm sure there's more information about it elsewhere too. Unfortunately we have to live with this because it's caused by a major NPM release (7+) with breaking changes.

Best, David

boris61 commented 2 years ago

Thanks for explanation and the link.

davidjerleke commented 1 year ago

@boris61 I have an update on this issue. Thanks to @horseeyephil's contributions, you can install embla-carousel-react without the --legacy-peer-deps from v7.0.5 and up. I didn't know that an or syntax was valid in the package.json peerDependecies field. Read more about the release here.

Cheers, David