Skip to content

Create-react-app stuck on v4.0.3, cannot create a new app #11754

Description

@rydwhelchel

Describe the bug

When attempting to use npx create-react-app <app-name>, I get the following error:

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

What I have tried to fix it:

  1. Run npm uninstall -g create-react-app to uninstall any global versions of create-react-app
  2. Run npm i -g npm@latest to update npm
  3. Run npm uninstall -g create-react-app && sudo npm cache clean -f to try and clean any cached information regarding create-react-app.

Below is a gif showing the issue in real time.

Which terms did you search for in User Guide?

Latest release

Environment

Unfortunately, the npx create-react-app info command ends up with the same error.

I am currently on Mac v12.0.1. Please request more info if needed.

Steps to reproduce

  1. Attempt to run npx create-react-app <app-name-here>

Expected behavior

A React app is created.

Actual behavior

create-react-app errors due to incorrect version.

image

Activity

  1. Newbie012 commented on Dec 14, 2021

    @Newbie012

    run

    npx create-react-app@5.0.0 app-name
    
  2. rydwhelchel commented on Dec 14, 2021

    @rydwhelchel
    Author

    Dang it's that simple huh. Thanks, that worked like a charm!

    Is there something I can do on my end to set default behavior of create-react-app to use the newest version? That way I don't have to specify a version any time there is an update?

  3. Newbie012 commented on Dec 14, 2021

    @Newbie012

    Sadly not that I know of

  4. Runejm commented on Dec 15, 2021

    @Runejm

    I faced the exact same issue today - fixed it by running
    Step 1: npm uninstall -g create-react-app
    Step 2: npm -g create-react-app@latest

    Followed by:
    Step 3: npx create-react-app my-app

    let me know if it helps.

  5. labnol commented on Dec 15, 2021

    @labnol

    run

    npx create-react-app@5.0.0 app-name
    

    Thank you. That worked!

  6. mryechkin commented on Dec 15, 2021

    @mryechkin

    Is there something I can do on my end to set default behavior of create-react-app to use the newest version? That way I don't have to specify a version any time there is an update?

    Make sure you don't have create-react-app installed globally, and then just run npx create-react-app any time you need to use it. If you have it installed globally, it'll use whatever version is installed locally on your machine, rather than pulling the latest.

  7. mryechkin commented on Dec 15, 2021

    @mryechkin

    I faced the exact same issue today - fixed it by running
    Step 1: npm uninstall -g create-react-app
    Step 2: npm -g create-react-app@latest

    Followed by: Step 3: npx create-react-app my-app

    let me know if it helps.

    FYI you don't need to have create-react-app installed globally if you're going to use npx to run it. That's the whole point of npx - it pulls the latest version from NPM whenever you run that command. There's no need for Step 2 above

  8. jestrickler commented on Dec 15, 2021

    @jestrickler

    That's the problem. npx is NOT pulling the latest version. The workaround npx create-react-app@5.0.0 app-name will let you create a react app. But if you go back to the standard npx create-react-app my-app it goes back to this broken looping behavior where it is globally installing 4.0.3, then telling you to uninstall it... rinse... repeat

  9. Runejm commented on Dec 15, 2021

    @Runejm

    Agree, but if you use the method I listed above, npx does not default back to broken behavior.

    So @mryechkin might be right in saying that: it is not needed to install "create-react-app" globally. however I found this to be the only way to "clear" the faulty behavior.

  10. jestrickler commented on Dec 15, 2021

    @jestrickler

    @Runejm right, but you have to have the @latest installed globally, which you shouldn't with npx. If you run npm uninstall -g create-react-app it goes right back to 4.0.3 broken behavior.

  11. janhavi-ai commented on Dec 15, 2021

    @janhavi-ai

    run

    npx create-react-app@5.0.0 app-name
    

    During set-up I got the following error:

    npm ERR! code ETARGET
    npm ERR! notarget No matching version found for @babel/plugin-transform-react-jsx-development@^7.16.5.
    npm ERR! notarget In most cases you or one of your dependencies are requesting
    npm ERR! notarget a package version that doesn't exist.
    
  12. jestrickler commented on Dec 15, 2021

    @jestrickler

    Actually npx create-react-app@latest my-app works and should continue to work with a newer release..?

  13. Runejm commented on Dec 15, 2021

    @Runejm

    @Runejm right, but you have to have the @latest installed globally, which you shouldn't with npx. If you run npm uninstall -g create-react-app it goes right back to 4.0.3 broken behavior.

    Ahh, yeah that is correct.

  14. Runejm commented on Dec 15, 2021

    @Runejm

    so, the solution seems to be found here. Tested it on my machine, and it worked.

    I didn't know that npx had its own cache.

  15. NathanMartinez commented on Dec 15, 2021

    @NathanMartinez

    I also ran into this issue today. I ran all above workarounds such as:

    npm uninstall -g create-react-app
    npx clear-npx-cache
    npx create-react-app@latest my-app --use-npm
    npx create-react-app@5.0.0 app-name
    and npx create-react-app@latest my-app with no success.

    I am running nvm version 0.39.0, node version v16.13.1, npm version 8.3.0, and npx version 8.3.0 if that helps at all.

    I did however have success with running the yarn create react-app my-app in case any others have the same issues as me. I am running yarn version 1.22.17.

    Best!

  16. Runejm commented on Dec 16, 2021

    @Runejm

    @NathanMartinez A dumb question: did you try to clear npm cache and do a reboot in addition to the other tries?

  17. NathanMartinez commented on Dec 16, 2021

    @NathanMartinez

    @Runejm Very good question actually. I did try clearing out the cache with a few commands I was able to find poking around. I also did try terminating my terminal sessions, however, I didn't think to do a reboot.

    I will definitely try that out tonight!

    If it does resolve the issue I'll be sure to post it here as well.

    Thank you for the insight!

  18. vibonacci commented on Dec 16, 2021

    @vibonacci

    When creating a fresh CRA app, it prints:

    You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).
    We no longer support global installation of Create React App.

    Please remove any global installs with one of the following commands:

    • npm uninstall -g create-react-app
    • yarn global remove create-react-app

    Would be nice if the message included that you probably need to run npx clear-npx-cache for the uninstallation to properly take effect.

  19. raix commented on Dec 17, 2021

    @raix
    Contributor

    Seem related to #11772

  20. added this to the 5.0.1 milestone on Dec 17, 2021
  21. chuchude commented on Dec 21, 2021

    @chuchude

    npx create-react-app@5.0.0 app-name

    When running this command, I got npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

  22. chuchude commented on Dec 21, 2021

    @chuchude

    Just fix the issue by running npm install -g create-react-app@5.0.0

  23. chuchude commented on Dec 21, 2021

    @chuchude

    Just fix the issue by running npm install -g create-react-app@5.0.0

    @chuchude That is the problem. You should not need to install it globally. Using npx create-react-app app-name should always use the latest version without a global install. You can also use npx create-react-app@latest my-app as a workaround for the issue, but perhaps the React.js documentation needs to be updated if @latest needs to be included from now on.

    Yes, I did try the npx create-react-app@latest my-app and npx create-react-app@5.0.0 my-app. But it doesn't work either. So I ran the npm outdated and I still can see the create-react-app 4.0.3, even though I have run the uninstall command. So I just manually install the 5.0.0. And then run npx create-react-app myapp. And It works. I guess something wrong with my PC. I don't quite understand why.

  24. muneeb-devp commented on Dec 22, 2021

    @muneeb-devp

    When creating a fresh CRA app, it prints:

    You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).
    We no longer support global installation of Create React App.
    Please remove any global installs with one of the following commands:

    • npm uninstall -g create-react-app
    • yarn global remove create-react-app

    Would be nice if the message included that you probably need to run npx clear-npx-cache for the uninstallation to properly take effect.

    Tried it after uninstalling the global install of create-react-app using npm uninstall -g create-react-app, it got stuck in the same loop again:

    First run:

    npx clear-npx-cache
    Need to install the following packages: clear-npx-cache Ok to proceed? (y) y

    Second run:

    npx clear-npx-cache
    Need to install the following packages: clear-npx-cache Ok to proceed? (y)

    Pretty sure that's not how it's supposed to be!

  25. modified the milestones: 5.0.1, 5.0.2 on Apr 12, 2022
  26. BigLeo16 commented on Jul 12, 2023

    @BigLeo16

    J

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions