can not create-react-app
webjohnjiang opened this issue · 12 comments
Describe the bug
I crreate react app along with the document, but i can't go through the first step.
Environment
macbook pro m4,
nodejs: 22.12.0
npm: 10.9.0
Steps to reproduce
I have tried to add force flag to the command, although it can create the folder, but it can not start.
ig: npx --legacy-peer-deps create-react-app
The start error screenshot is:

Then, i try to npm audit fix --force and remove react dependencies and reinstall react with npm install react@18 react-dom@18, it finally works.
But i think it maybe has some potential issue. I wonder what's the right way to run create-react-app?
Same error here. Using node v22.12.0 and npx 10.9.0, with nvm 0.40.1. On Mac OS 15.2 with M1 processor.
Had the same issue when creating a typescript app. I ran the npm install manually with some updated package versions:
npm install --no-audit --save \
@testing-library/jest-dom@^6.6.3 \
@testing-library/react@^16.1.0 \
@testing-library/user-event@^14.5.2 \
@types/jest@^29.5.14 \
@types/node@^22.10.2 \
@types/react@^19.0.0 \
@types/react-dom@^19.0.0 \
typescript@^4.9.4 \
web-vitals@^4.2.4typescript 5.x does not work though because the latest react-scripts 5.0.1 has deps on typescript < 5.x
I too faced the same error and i have resolved it by adding this command "npm install web-vitals"
This problem seems to have been happening for weeks. I don't know why it still hasn't been fixed, but based on the issue here:
Using the following command could be a temporary fix if it's really urgent:
yarn create react-app moduleSolution (if keep using npm):
(a) downgrade to react 18
(b) keep using react 19 but use the latest version of testing-library/react.
npx create-react-app app_name still generates error, but then manually changing the @testing-library/react to version 16.1.0 works for me. Seems like it's the compatible version with react 19
rm -rf node_modules package-lock.json
"dependencies": {
"@testing-library/react": "^16.1.0",
"cra-template": "1.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-scripts": "5.0.1",
},
npm install
no errors on this
There are two solutions to the compatibility issue caused by using react19 version.
-> First remove the package lock file and node_modules
rm package-lock.json
rm -rf node_modules
-> Change the react deps from "^19.0.0" to "^18.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0",
->
npm i
->
npm install --save web-vitals
npm install --save-dev @testing-library/jest-dom @testing-library/react @testing-library/user-event
yarn create react-app my-app
rm package-lock.json
rm -rf node_modules
you are able to use create-react-app but since it is a legacy code it will give you many errors on intalling and initializing the app.
After the error do cd nameYouCreated for the create react app.
Then inside the created-react-app you can do npm i and npm init. so you can continue the Process.
Then npm install --save web-vitals
npm install --save-dev @testing-library/jest-dom @testing-library/react @testing-library/user-event
Then you should be able to do npm start and start the app.
This code is too old and non-compatible with the versions of React that we have available. Unfortunately older version of react that would be compatible are no longer available,
Guys no point trying to resolve this because its not really maintained. Not worth it. Above solutions did not work for me. Just use vite create-react-ts - https://vite.dev/guide/
I have the same issue
Installing template dependencies using npm...
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: frontend-movie5@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\zangn\AppData\Local\npm-cache_logs\2024-12-25T07_28_48_384Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\zangn\AppData\Local\npm-cache_logs\2024-12-25T07_28_48_384Z-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
PS E:\src\frontend-movie4>
Wrong repository, the problem is not for React Scripts, is Testing Library for React: testing-library/react-testing-library#1372

