testing-library/react-testing-library

React v19

Closed this issue · 3 comments

  • @testing-library/react version:
    npm error code ERESOLVE
    npm error ERESOLVE could not resolve
    npm error
    npm error While resolving: @testing-library/react@13.4.0
    npm error Found: react@19.0.0
    npm error node_modules/react
    npm error peer react@">=16.8.0" from @floating-ui/react@0.26.28
    npm error node_modules/@floating-ui/react
    npm error @floating-ui/react@"^0.26.16" from @headlessui/react@2.2.0
    npm error node_modules/@headlessui/react
    npm error @headlessui/react@"^2.2.0" from the root project
    npm error peer react@">=16.8.0" from @floating-ui/react-dom@2.1.2
    npm error node_modules/@floating-ui/react-dom
    npm error @floating-ui/react-dom@"^2.1.2" from @floating-ui/react@0.26.28
    npm error node_modules/@floating-ui/react
    npm error @floating-ui/react@"^0.26.16" from @headlessui/react@2.2.0
    npm error node_modules/@headlessui/react
    npm error @headlessui/react@"^2.2.0" from the root project
    npm error 12 more (@headlessui/react, @heroicons/react, ...)
    npm error
    npm error Could not resolve dependency:
    npm error peer react@"^18.0.0" from @testing-library/react@13.4.0
    npm error node_modules/@testing-library/react
    npm error @testing-library/react@"^13.0.0" from the root project
    npm error
    npm error Conflicting peer dependency: react@18.3.1
    npm error node_modules/react
    npm error peer react@"^18.0.0" from @testing-library/react@13.4.0
    npm error node_modules/@testing-library/react
    npm error @testing-library/react@"^13.0.0" 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.
    npm error
    npm error
    npm error For a full report see:
    npm error /root/.npm/_logs/2024-12-27T03_21_14_639Z-eresolve-report.txt
    npm error A complete log of this run can be found in: /root/.npm/_logs/2024-12-27T03_21_14_639Z-debug-0.log
    root@08a8e9206784:/app# npm install -D tailwindcss

Relevant code or config:

var your => (code) => here;

What you did:

Just install fresh React v19

What happened:

preventing to install packages

Reproduction:

node -v
v23.5.0
npm -v
10.9.2

Problem description:

Suggested solution:

point the @types/react and @types/react-dom version to 18 could solve this npm install prolem

npm install --save-dev @testing-library/react @testing-library/dom @types/react@18 @types/react-dom@18

I resolved issues by upgrading to latest

@testing-library/dom": "^10.4.0
@testing-library/jest-dom": "^6.6.3
@testing-library/react": "^16.1.0
@testing-library/user-event": "^14.5.2

React 19 support was added to RTL in version 16.1.0.