Skip to content

can not create-react-app #13727

Description

@webjohnjiang

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?

Activity

  1. mariomac commented on Dec 16, 2024

    @mariomac

    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.

  2. Type1J commented on Dec 16, 2024

    @Type1J

    This is a duplicate of #13721.

  3. PattemChaitanya commented on Dec 17, 2024

    @PattemChaitanya

    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

  4. PerArneng commented on Dec 17, 2024

    @PerArneng

    ⚠️ 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

  5. Deepak-raj-k commented on Dec 18, 2024

    @Deepak-raj-k

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

  6. ElessarWillomoont commented on Dec 19, 2024

    @ElessarWillomoont

    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:

    react/react#31701

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

    yarn create react-app module
  7. galuhalifani commented on Dec 20, 2024

    @galuhalifani

    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

  8. menciusKael commented on Dec 20, 2024

    @menciusKael

    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

  9. delvissoto commented on Dec 22, 2024

    @delvissoto

    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,

  10. asfand987 commented on Dec 24, 2024

    @asfand987

    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/

  11. petervn commented on Dec 25, 2024

    @petervn

    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>

  12. yhojann-cl commented on Dec 25, 2024

    @yhojann-cl

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions