247

I got an error while creating a React application. How do I fix it?

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Athif Saheer
  • 4,539
  • 3
  • 9
  • 14

6 Answers6

969

Try running this:

npx clear-npx-cache
ProgrammerS
  • 9,715
  • 2
  • 2
  • 3
  • 58
    This worked for me as well. I think this should be marked as the correct answer as it doesn't require forcing the latest version. – Patrick Haertel Dec 18 '21 at 19:08
  • 1
    This worked for me too. This issue happened even after a fresh install of node js. This fix worked like a charm. <3 – emkarachchi Jan 20 '22 at 15:08
  • 10
    I think we need to add more detail on why this work – alvseek Feb 02 '22 at 04:43
  • 4
    This is the correct answer I tried to find more details. Based on the response from James L here: https://stackoverflow.com/questions/63510325/how-can-i-clear-the-central-cache-for-npx create-react-app is still in npx cache memory even though it is not installed globally so clearing the npx cache using the command above solves it. – BoyePanthera Mar 28 '22 at 14:34
  • 1
    this fixed my issue also, no idea why this is crashing. but thanks – DRProgrammer Mar 30 '22 at 14:46
  • If you don't want to download `clear-npx-cache`, run `rm -rf ~/.npm/_npx` instead – Codler May 30 '22 at 11:42
  • This didn't work for me, running `npm update npx` and then `npx create-react-app my-app` worked – ida Jun 02 '22 at 04:53
  • Got this! `The system cannot find the path specified.` – cmcodes Jun 21 '22 at 04:21
  • I've been stuck on this problem for hours. Thank you so much! Upvoted. – Pyzard Jul 26 '22 at 15:29
184

It's fixed. I do npx create-react-app@5.0.0 my-app.

Reference: Error while creating new React app ("You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)")

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Athif Saheer
  • 4,539
  • 3
  • 9
  • 14
  • 3
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 15 '21 at 06:04
  • 8
    Do `npx clear-npx-cache` if you don't want to have to specify the cra version. – Michael Fulton Jan 02 '22 at 17:23
  • 5
    I could solve this problem using `npx create-react-app@latest my-app` – vinhtranchau Jan 10 '22 at 10:44
  • 1
    After clearing the cache for npm for almost 30 minutes to no avail. This worked for me. Sometimes you need to slow down and refocus. npx not npm – blakroku Jan 13 '22 at 14:38
74

npx clear-npx-cache worked for me.

Try npx clear-npx-cache to clear your npx cache and then running the npx create-react-app your-app.

Additionally, it might be worth trying to force the latest version with:

npx create-react-app@latest my-app --use-npm
47

It's solved. By using this code:

npx create-react-app@5.0.0 my-app

If it does not work, use this and try again:

Delete everything from C:\Users\your_pc_name\AppData\Roaming\npm-cache

This could be a local caching issue. Try the command npm cache clean --force using administrator mode in your terminal and then try again with the same command - npx create-react-app my-app.

Zain Alabdeen
  • 479
  • 3
  • 7
23

Follow this:

npm uninstall -g create-react-app

npm cache clean --force”

npm cache verify

npx create-react-app my-app

Juan Robledo
  • 339
  • 1
  • 5
3

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.

this works--npx create-react-app@5.0.0 my-app

Srinidhi S
  • 55
  • 2