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

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

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 23
  • Comments: 25 (1 by maintainers)

Most upvoted comments

run

npx create-react-app@5.0.0 app-name

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

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.

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.

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.

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!

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.

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

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

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.