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

can not create-react-app #13727

Open
webjohnjiang opened this issue Dec 15, 2024 · 12 comments
Open

can not create-react-app #13727

webjohnjiang opened this issue Dec 15, 2024 · 12 comments

Comments

@webjohnjiang
Copy link

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

image

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:
image

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?

@mariomac
Copy link

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.

@Type1J
Copy link

Type1J commented Dec 16, 2024

This is a duplicate of #13721.

@PattemChaitanya
Copy link

Same here.

Two different kinds of scenarios occurred

  1. In the initial use of create react app. Everything went well except web-vitals packages.
  2. After deleting entire project. Starting from scratch it is not initial create react app.

Error message.
image

@PerArneng
Copy link

PerArneng commented Dec 17, 2024

⚠️ Note: this makes the install work but when i run it seems like something else is broken.

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.4

typescript 5.x does not work though because the latest react-scripts 5.0.1 has deps on typescript < 5.x

@Deepak-raj-k
Copy link

I too faced the same error and i have resolved it by adding this command "npm install web-vitals"

@ElessarWillomoont
Copy link

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:

facebook/react#31701

Using the following command could be a temporary fix if it's really urgent:

yarn create react-app module

@galuhalifani
Copy link

galuhalifani commented Dec 20, 2024

Solution (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

@menciusKael
Copy link

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

@delvissoto
Copy link

delvissoto commented Dec 22, 2024

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,

@asfand987
Copy link

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/

@petervn
Copy link

petervn commented Dec 25, 2024

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: [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:\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>

@yhojann-cl
Copy link

Wrong repository, the problem is not for React Scripts, is Testing Library for React: testing-library/react-testing-library#1372

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

No branches or pull requests