Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve dependency: peer react@"^18.0.0" from @testing-library/[email protected] #13873

Open
wanesoft opened this issue Jan 16, 2025 · 21 comments

Comments

@wanesoft
Copy link

node --version
v22.13.0
npx --version
10.9.2
npx create-react-app test-use-state

Creating a new React app in /root/test-use-state.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


added 1323 packages in 25s

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

Initialized a git repository.

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 /root/.npm/_logs/2025-01-16T15_24_57_774Z-eresolve-report.txt
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-01-16T15_24_57_774Z-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
@6lyxt
Copy link

6lyxt commented Jan 17, 2025

bumping this

@stackcv
Copy link

stackcv commented Jan 20, 2025

:bump:

@william-aqn
Copy link

bump %)

1 similar comment
@origicom
Copy link

bump %)

@sabrina-stangler
Copy link

retweet

@MonteMango
Copy link

bump

2 similar comments
@fightingsleep
Copy link

bump

@TimZaman
Copy link

bump

@funkjunky
Copy link

Ah, so currently the happy path of create-react-app doesn't even work... bummer

@heyitsbryanm
Copy link

bump

using windows surface pro on ARM

@manutrix
Copy link

bump

@Hernandezn
Copy link

Hernandezn commented Jan 23, 2025

I'm having this same issue! A band-aid solution should work for now since this thread looks new, but because it looks like there haven't been any non-documentation changes in over a year, it looks like this problem is the result of the development team having abandoned this project. If you want to continue, here's the full set of commands I used to clean up the errors for a successful run of a new React application.

Just note, this is a temporary solution, in that the create-react-app repo has had nothing but documentation changes since August 2023 (with the last build release being from 2022), so while there has been no official deprecation of this tool, this issue indicates that create-react-app is rotting. The below commands will clean up the current issues with new projects, but expect this tool to continue to show signs of its abandonment.

npx create-react-app my-app

The above generates the same errors we're all observing. The below commands are the cleanup.

cd my-app
npm install --save-dev @testing-library/react@latest
npm install web-vitals
npm start

Upon npm start, it should say it compiled successfully, and the app should run for you without an error popping up.

@OndrejPlecak
Copy link

create-react-app is deprecated. You must use Vite to initialize a project.

https://medium.com/@miahossain8888/how-to-create-a-react-app-with-vite-571883b100ef

@davidt4444
Copy link

I've been playing with different AI generators and they provided Vitae as a faster development process and it didn't throw an error.
npm create vite@latest your-app -- --template react-ts
cd your-app
npm install
npm run dev

@mbrunel-H
Copy link

bump

@alxndrsn
Copy link

alxndrsn commented Feb 3, 2025

create-react-app is deprecated. You must use Vite to initialize a project.

You can still use create-react-app if you want to.

For me, the following works:

npx create-react-app test-cra # n.b. this step will report failure
cd test-cra
yarn
yarn add web-vitals
yarn start

@coarsehorse
Copy link

bump

1 similar comment
@stepan323446
Copy link

bump

@scifisamurai
Copy link

The create-react-app README has been updated to indicate that this project is now deprecated. See #17003 which was merged January 28, 2025.

@VladyslavKurmaz
Copy link

You need to install one more package to make unit tests work (in addition to @Hernandezn answer)

npm install --save-dev @testing-library/jest-dom@latest
npm run test

@satyendrasonwani
Copy link

This worked for me and React is running perfectly fine. Thank you so much for the help @Hernandezn

npm install --save-dev @testing-library/react@latest

npm install web-vitals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests