-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Error from using npx create-react-app #13721
Comments
This prevents use of |
Looks like a peer dependency issue with react testing libray. The react testing library recently added support for react 19. Simply upgrading this package.json to latest testing library version 16.1.0 should work |
what causes this problem is that the default versions of create-react-app are old versions that do not support the new react 19. the simple solution to this error:
this should fix the issue about testing-library dependencies and reportWebVitals from the index.js file. however, if you don't use these packages testing-library and web-vitals
and this should work fine. you have to do this everytime you created a project until they release v6.0.0 of create-react-app. if you dont want to do this every time and only with one command i suggest using custom template then update the dependencies version to a newer versions in package.json file directly. i hope this is helpful. |
Based on above instructions from @Dyurandaru, if you want react 18. First remove the package lock file and node_modules rm package-lock.json
rm -rf node_modules Change the react deps from "react": "^18.0.0",
"react-dom": "^18.0.0", Then npm install Then npm install --save web-vitals Then npm install --save-dev @testing-library/jest-dom @testing-library/react @testing-library/user-event RequestCan we make it so that create-react-app optionally takes an ENV var with the desired version of React instead of always getting the latest? |
And to support TypeScript, after doing this^ npm install --save-dev typescript @types/node @types/react @types/react-dom @types/jest Then rename files from I had to delete the And finally, create a {
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"skipLibCheck": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"types": [
"react-scripts"
]
},
"include": [
"src",
]
} |
How can I use an older version of create-react-app as the current one is broken - as described in this issue |
This PR should fix the issue |
On this issue #13289 I read that the create-react-app is pretty much dead. It isn't even referenced in the official react docs as well. If you read though the comments at the linked issue you'll see the recommended method is to create a react app using https://vitejs.dev/ or converting your existing project to Vite |
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: bai-37@0.1.0
npm error Found: react@19.0.0
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/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 C:\Users\PC\AppData\Local\npm-cache_logs\2024-12-11T07_56_15_943Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\PC\AppData\Local\npm-cache_logs\2024-12-11T07_56_15_943Z-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
failedThe text was updated successfully, but these errors were encountered: