atlassian / react-beautiful-dnd

Beautiful and accessible drag and drop for lists with React
https://react-beautiful-dnd.netlify.app
Other
33.32k stars 2.55k forks source link

Cannot install for react 18 #2426

Closed Olivernha closed 2 years ago

Olivernha commented 2 years ago

In react 18 installed with vite , when installing react-beautiful-dnd, npm err happens.Anyone fix about it?

hexwit commented 2 years ago

@types/react-beautiful-dnd cannot be installed for react 18.

webapp$ npm i --save-dev @types/react-beautiful-dnd
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: webapp@0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.5 || ^17.0.0" from react-beautiful-dnd@13.1.0
npm ERR! node_modules/react-beautiful-dnd
npm ERR!   react-beautiful-dnd@"^13.1.0" from the root project
npm ERR! 
hexwit commented 2 years ago

Update: deleting node_modules and installing deps again solved the problem.

AmineDeflaoui commented 2 years ago

Update: deleting node_modules and installing deps again solved the problem.

I tried delete node_modules and reinstall deps again, it does not solve the problem for me, until I downgrade React version to 17 again

Update : moving the content of the peer-dependency of react-beautiful-dnd@13.1.0 in package-lock.json solved the problem. moving react From "peerDependencies":{ "react":"^16.8.5 || ^17.0.0" } to -> "Dependencies":{ "react":"18.0.2" }

Jova266 commented 2 years ago

is there another way to use this in react 18?

Code-Divine commented 2 years ago

Fix this for gods sake. There are no breaking changes just update react in your project.

anti-duhring commented 2 years ago

rade React version to 17 again

Try install with --force command

npm install react-beautiful-dnd --save --force

kamami commented 2 years ago

Same problem

AmineDeflaoui commented 2 years ago

Same problem

Just update your react-beautiful-dnd dependencies it will solve the problem

Jova266 commented 2 years ago

rade React version to 17 again

Try install with --force command

npm install react-beautiful-dnd --save --force

Will --force cause some other problems?

Jova266 commented 2 years ago

Same problem

Just update your react-beautiful-dnd dependencies it will solve the problem

In order to have dependencies I need to install it first on react 17, then move to react 18? and after that change the dnd dependencies?

AmineDeflaoui commented 2 years ago

Yes that's what I did, I re-installed react 17.0.2 again , npm install => no problems , then I updated React to 18 npm install = > show the error , then I change the dependencies of react-beautiful-dnd to correspond to React 18 , npm install => no errors . And For your first question : if you do "npm install react-beautiful-dnd --save --force" or "--legacy-peer-deps" it will move react to peerDependencies and ignore all peerDependencies when installing, and each time yo udo npm install you always need to add --force or --legacy-peer-deps

JClackett commented 2 years ago

Pleaseee can this be updated

Xhale1 commented 2 years ago

🎉 @hello-pangea/dnd now supports React 18 and react strict mode!

  1. npm install @hello-pangea/dnd
  2. Replace all imports of react-beautiful-dnd with @hello-pangea/dnd
  3. Enjoy :)
anti-duhring commented 2 years ago

Hello! I released a fork of this project which supports React 18.

Run npm install @hello-pangea/dnd and replace all imports of react-beautiful-dnd with @hello-pangea/dnd (I just did a find all and replace)

A few changes had to be made to the library to get it to work with React 18's development mode changes. Hoping to continue development there :)

https://github.com/hello-pangea/dnd

Nice! There's any discord/forum to support this lib? I would love to help

Xhale1 commented 2 years ago

Nice! There's any discord/forum to support this lib? I would love to help

Sure sure! Glad you're interested in helping out!

https://discord.gg/3JqZpTFD (note: I just made this so it's pretty empty)

We should probably move things over to the hello-pangea/dnd repo so we don't spam notify people here / get too off topic.

danieldelcore commented 2 years ago

Accepted react versions have been updated. Thanks for the patience on this folks

bassamIHabash commented 1 year ago

is there any update?