skip to Main Content

Installing template dependencies using npm…

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error   react@"^19.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^18.0.0" from @testing-library/[email protected]
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 C:UsersKrishnaAppDataLocalnpm-cache_logs2024-12-06T06_18_52_109Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:UsersKrishnaAppDataLocalnpm-cache_logs2024-12-06T06_18_52_109Z-debug-0.log
npm error C:UsersKrishnaAppDataLocalnpm-cache_logs2024-12-06T06_18_52_109Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:UsersKrishnaAppDataLocalnpm-cache_logs2024-12-06T06_18_52_109Z-debug-0.log

npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^13.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0 failed

I use react version 19 and this erorr throw ,any other solution for this without –force or –legacy-peer-deps

2

Answers


  1. This is a peer dependency issue. You are using React 19, but @testing-library/[email protected] doesn’t support it. You can either upgrade @testing-library/react to at least version 16.1.0 or downgrade to React 18.

    Reference:
    https://github.com/testing-library/react-testing-library/releases/tag/v16.1.0

    Login or Signup to reply.
  2. I found the solution here: https://www.youtube.com/watch?v=PeKq_cGZcnY
    Check if it helps you.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search