aws-amplify / amplify-ui

Amplify UI is a collection of accessible, themeable, performant React (and more!) components that can connect directly to the cloud.
https://ui.docs.amplify.aws
Apache License 2.0
914 stars 295 forks source link

react 19 support #6084

Open oste opened 1 week ago

oste commented 1 week ago

As expected, I'm encountering a dependency error when running npm install with the latest versions of Next.js and React 19 RC. I'm wondering if there’s a way to make Amplify UI work with React 19, or if there’s a planned roadmap for adding support for react 19. Thanks!

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: blog@0.1.0
npm error Found: react@19.0.0-rc-66855b96-20241106
npm error node_modules/react
npm error   react@"19.0.0-rc-66855b96-20241106" from blog@0.1.0
npm error   apps/blog
npm error     blog@0.1.0
npm error     node_modules/blog
npm error       workspace apps/blog from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.14.0 || ^17.0 || ^18.0" from @aws-amplify/ui-react@6.5.5
npm error node_modules/@aws-amplify/ui-react
npm error   @aws-amplify/ui-react@"^6.5.5" from blog@0.1.0
npm error   apps/blog
npm error     blog@0.1.0
npm error     node_modules/blog
npm error       workspace apps/blog from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
cwomack commented 1 week ago

Hello, @oste and thank you for opening this issue. We'll mark this as a feature request since the versions mentioned here are still release candidates, but we'll update this issue as soon as we have support for the released versions. Thanks!

If you're using JavaScript, things should still work but this has not been fully tested yet. Per the error message you've listed, you can use the --legacy-peer-deps command as well to test this if you'd like.

oste commented 1 week ago

I did try legacy peer deps but didn’t have success but maybe that’s another issue with my dependency tree

dindjarinjs commented 1 week ago

Just tried the following commands and I didn't get any errors:

npx create-next-app test-react-19 # creates a Nextjs project using React 19RC
cd test-react-19
npm install aws-amplify @aws-amplify/ui-react --legacy-peer-deps

Output:

➜  test-react-19 git:(main) npm install aws-amplify @aws-amplify/ui-react --legacy-peer-deps
added 232 packages, and audited 269 packages in 10s

16 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Maybe try --force? What version of npm are you using? I'm using npm 10.2.4.