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

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

Open
rydwhelchel opened this issue Dec 14, 2021 · 25 comments
Open

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

rydwhelchel opened this issue Dec 14, 2021 · 25 comments

Comments

@rydwhelchel
Copy link

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

@Newbie012
Copy link

Newbie012 commented Dec 14, 2021

run

npx create-react-app@5.0.0 app-name

@rydwhelchel
Copy link
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?

@Newbie012
Copy link

Sadly not that I know of

@Runejm
Copy link

Runejm commented Dec 15, 2021

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.

@labnol
Copy link

labnol commented Dec 15, 2021

run

npx create-react-app@5.0.0 app-name

Thank you. That worked!

@mryechkin
Copy link

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.

@mryechkin
Copy link

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

@jestrickler
Copy link

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

@Runejm
Copy link

Runejm commented Dec 15, 2021

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.

@jestrickler
Copy link

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

@janhavi-ai
Copy link

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.

@jestrickler
Copy link

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

@Runejm
Copy link

Runejm commented Dec 15, 2021

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

@Runejm
Copy link

Runejm commented Dec 15, 2021

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.

@NathanMartinez
Copy link

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!

@Runejm
Copy link

Runejm commented Dec 16, 2021

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

@NathanMartinez
Copy link

@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!

@vibonacci
Copy link

vibonacci commented Dec 16, 2021

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.

@raix
Copy link
Contributor

raix commented Dec 17, 2021

Seem related to #11772

@chuchude
Copy link

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.

@chuchude
Copy link

chuchude commented Dec 21, 2021

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

@asbillt
Copy link

asbillt commented Dec 21, 2021

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.

@chuchude
Copy link

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.

@muneeb-devp
Copy link

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!

@iansu iansu added this to the 5.0.2 milestone Apr 12, 2022
@BigLeo16
Copy link

J

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