141

I tried installing create-react-app using npm i create-react-app, npx create-react-app new-app and npm init react-app new-app, but I keep getting this error message:

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

How can I fix this?

isherwood
  • 58,414
  • 16
  • 114
  • 157
Sumanth Hegde
  • 1,411
  • 2
  • 7
  • 3

42 Answers42

238

This worked for me:

npx create-react-app@latest your-project-name --use-npm
Aryan Beezadhur
  • 4,503
  • 4
  • 21
  • 42
MeVimalkumar
  • 3,192
  • 2
  • 15
  • 26
147

According to the create-react-app docs, create-react-app should not be installed globally:

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

This is even stated in the error message you recieved:

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

You must uninstall create-react-app with npm uninstall -g create-react-app.

Then each time you want to create a new React app with create-react-app, use the command npx create-react-app my-app.

So to fix the error you're getting, uninstall create-react-app globally, update npm, clear the cache, and retry creating the app.

Run this in your terminal:

npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f && npx create-react-app@latest my-app --use-npm
Aryan Beezadhur
  • 4,503
  • 4
  • 21
  • 42
34

I got

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.

so I simply called the package with an explicit version:

npx create-react-app@5.0.0 app-name
Eliya Cohen
  • 10,716
  • 13
  • 59
  • 116
  • If anyone is still facing that problem after uninstalling it globally and cleaning the cache, try to run `npm uninstall create-react-app` as you might have a non-global installation. – Stephen Fong Dec 15 '21 at 02:49
  • Using an explicit version after uninstalling globally and clearing the cache solved the problem for me – Leonardo Viada Aug 27 '22 at 08:56
27

I also faced this issue after they released v4.0.2.

They have mentioned this:

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

I resolved the issue by following the below steps:

  1. Uninstall create-react-app v4.0.1:

    # for npm:
    npm uninstall -g create-react-app
    
    # for yarn:
    yarn global remove create-react-app
    
  2. You are not required to install create-react-app in your local directory, so if you do not want to do this then move to step 3. If you want to do this, install v4.0.2 without using the global flag (-g or --global) using the below command:

    # for npm:
    npm i create-react-app
    
    # for yarn:
    yarn add create-react-app
    
  3. You can now create a new React app using the below command:

    # for npx:
    npx create-react-app my-app
    
    # for npm:
    npm init react-app my-app
    
    # for yarn:
    yarn create react-app my-app
    
Aryan Beezadhur
  • 4,503
  • 4
  • 21
  • 42
Jitesh Narula
  • 386
  • 3
  • 7
  • This works....it's important to note, if you use both npm and yarn for different reasons you may run into a situation where you try to uninstall create-react-app with the wrong package manager (not the one you installed it with). In that case, try both the npm and yarn uninstall command....one of them should work – Jo Momma Nov 06 '21 at 16:22
16

I also face the same problem but the problem gets solved when I uninstall the create-react-app globally and then again install it globally.

Uninstalling Command:

npm uninstall -g create-react-app

installing Command:

npx create-react-app my-app

if you have an older npm version (npm version < 5.2) then use this command :

npm install -g create-react-app

it solved my problem I hope it will solve yours

co_ssm
  • 193
  • 1
  • 9
  • 5
    This answer is incorrect: [`create-react-app` should **not** be installed globally](https://stackoverflow.com/a/65043610/12860895) – Aryan Beezadhur Nov 27 '20 at 20:49
10

Updating NPX worked for me. Suggestions on this page didn't do the trick but might have contributed.

npm update npx
Fatherjacob
  • 184
  • 1
  • 5
  • 2
    This was the only thing that worked for me! It's amazing how many errors can be resolved simply updating/reinstalling packages. – Matt Croak Mar 28 '21 at 18:04
9
 npm uninstall -g create-react-app

Although the uninstall command ran successfully , it was not able to uninstall create-react-app, so i kept running into the same error again and again

This finally worked for me npx create-react-app@latest my-app --template typescript

mohantyArpit
  • 373
  • 4
  • 9
8

What worked for me was:

npm uninstall -g create-react-app 

And then:

npm i create-react-app # or yarn add create-react-app

I also updated the Node version.

Aryan Beezadhur
  • 4,503
  • 4
  • 21
  • 42
ioanna89
  • 89
  • 3
8

Uninstalling create-react-app globally via npm and reinstalling without the global flag did not work for me.

npm uninstall -g create-react-app
npm install create-react-app

I was on node version 15.2.0. I upgraded to the latest stable node version 15.3.0 via nvm.

nvm install node

Then I installed create-react-app again (no global flag).

npm install create-react-app

I was then able to successfully create a new react app.

npx create-react-app my-app

EDIT: The above will install create-react-app to your current directory. To be clear, after uninstalling create-react-app globally I was no longer able to create an app via npx and received the same original error message. The best solution I've found so far is to run npm install -g npm@latest which downgraded my npm version from 7.0.14 dev build to 6.14.9 LTS build and allowed me to create the react app via npx without issue.

Alex Hall
  • 89
  • 6
  • `npm install create-react-app` outside of an npm project doesn't do anything. Just running `npx create-react-app my-app` will create a new React app. – Aryan Beezadhur Nov 27 '20 at 20:51
  • @ΛRYΛN Running 'npx create-react-app my-app' after uninstalling globally threw the same error as the original post. This did not work. Installing create-react-app without the global flag installed it to my current directory which allowed me to create a new react app but you're correct maybe it's not the best approach. I've found a better way and updated my post above but I'm still trying to figure out where exactly create-react-app is installed if not globally. I don't see it in any of the expect locations, mainly /Users/{username}/.nvm/versions/node/v15.3.0/lib/node_modules/npm/node_modules. – Alex Hall Dec 01 '20 at 03:15
6

After create-react-app > 4.0.1 use these commands

npm

npm init react-app my-app

yarn

yarn create react-app my-app

Getting Started | Create React App Docs

Shayan Shafiq
  • 1,447
  • 5
  • 18
  • 25
5

I have nvm installed, and while using the command npx create-react-app my-app; I got this error:

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

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

I confirmed that I did not have create-react-app installed globally in my nvm global directory.

I solved issue by specifying the version of the package

npx create-react-app@4.0.2 my-app
Breakpoint25
  • 1,273
  • 1
  • 9
  • 11
  • I had the same problem, peeked into my `~/.npm/_npx` and found the directory with 4.0.1, when providing the version and creating my react app, npx created the 4.0.2 as well. I wonder if this is a problem with npx not being able to clean it's cache or just being confused?! – Mazhar Zandsalimi Feb 14 '21 at 15:13
5

For me it was the issue with my npm version. So i did this:

npm install npm@latest -g

Now npx create-react-app app_name works.

kob003
  • 2,206
  • 2
  • 12
  • 19
4

I had to downgrade to the latest stable version of node with n in order to make it work.

sudo n stable

Just to make it clear, I never installed it globally, I just had this problem after upgrading node.

Shayan Shafiq
  • 1,447
  • 5
  • 18
  • 25
4

I know I'm late to the party, but here are my two cents to help you. This is how I made it worked

Uninstall Global create-react-app installation

npm uninstall -g create-react-app

Now clear the npx cache by

npx clear-npx-cache

Now try to create the application; if you still get the error saying we don't support create-react-app, change the directory to create the application

run

 npx create-react-app my-app

This is how I made this worked

Muhammad Umar
  • 1,291
  • 7
  • 13
3

There are two different causes of this error:

  1. You have create-react-app installed globally. Use this command to find out if you do: npm list -g --depth 0. If so, follow the instructions in the error message to uninstall it globally.

  2. You are using node v15.0.0+. Use NVM to switch to the LTS nvm use --lts and then run create-react-app. After that you can switch to v15.0.0+ and continue working. (If you do not have NVM installed, here is how you can install it: https://github.com/nvm-sh/nvm)

javedb
  • 228
  • 2
  • 12
  • 1
    #2 worked for me. I knew that I had not ever installed `create-react-app` globally and was confused by all the posts and documentation assuming that users _did_ install it globally. Thanks! – Colorful Tones Dec 01 '20 at 14:37
  • I don't have it installed globally and I'm using node `14.15.4`, so there is another cause for it. I have yet to figure it out. – Sean256 Jan 05 '21 at 17:47
3

For me I got the same error even though create-react-app was installed in a parent directory, not globally. So I ran npm uninstall create-react-app without the -g flag and it worked.

Dashiell Rose Bark-Huss
  • 2,173
  • 3
  • 28
  • 48
  • @Can we use this approach? I am a beginner and not very sure if this will cause any issues in the future? – Auo Feb 05 '21 at 16:05
  • First off, when you uninstall a package you can always undo what you did by reinstalling. You would do this by running in the root of the directory that the package was deleted from- `npm install create-react-app` or if you want to reinstall the a specific version `npm install create-react-app@1.2.0`. But I don't think you would need to do that because as I understand it the idea is to use npx which as I understand it doesn't download any packages but uses the package hosted on on the npm registry. So you don't need the `create-react-app` package on your computer at all to use the package. – Dashiell Rose Bark-Huss Feb 05 '21 at 18:40
  • When you run `npx create-react-app new-app` you're saying "Hey npm server, please use the create react package on your server to help me create a react app." – Dashiell Rose Bark-Huss Feb 05 '21 at 18:41
3

Using Git Bash on Windows i run into the same issue today

npx create-react-app appname 

even didn't worked after i uninstalled the global installation with

npm uninstall -g create-react-app

What solved the problem for me was to clean the npm cache with the following command

npm cache clean -f
golfo
  • 85
  • 5
3

This worked for me.

sudo npm uninstall create-react-app -g

sudo npm install create-react-app@5.0.0 -g

npx create-react-app my-app
Edison D'souza
  • 4,551
  • 5
  • 28
  • 39
2

Solution-1: Update your node package manager by using the command below.

npm install -g npm@latest
npx create-react-app my-app

Solution-2: Run your PowerShell as administrator and run the commands. Something this will not work

npm uninstall -g create-react-app
npm install -g create-react-app
//OR
npx create-react-app my-app

Solution-3: The permanent solution is to uninstall node.js and NPM and install them once again.

enjoy

Inder Pal Singh
  • 380
  • 4
  • 16
MD SHAYON
  • 7,001
  • 45
  • 38
2

i was facing same issues a while ago

npx create-react-app@latest app-name 

worked for me

Nischal
  • 39
  • 2
1

use this :

npm install create-react-app
  • 1
    `npm install create-react-app` outside of an npm project doesn't do anything. Just running `npx create-react-app my-app` will create a new React app. – Aryan Beezadhur Nov 27 '20 at 20:51
1

I ran into this myself today and my root cause is likely very rare but perhaps it will help someone else.

I had an npm registry defined in my .npmrc which my work requires us to use. Turns out my work mirror didn't have 4.0.1 and something in create-react-app must phone home and run a version check.

If you have a registry defined run npm view create-react-app to check the latest version.

Sean256
  • 2,849
  • 4
  • 30
  • 39
1

After exploring the Github issues a bit I found a solution to this problem that was posted, which doesnt require downgrading node or npm.

I'm using Ubuntu on WSL2 so keep in mind locations might vary. The problem comes from npm having cached a global installation of create-react-app with npx that is v4.0.0 which doesnt show when you use npm view create-react-app.

If you find your npm cache which for me was located in ~/.npm/_npx/ folder, you will find folders with hashed names from all your global installs where you have used npx previously.

If you look through each of them for example with cat [hash]/package.json and note down the hash of any that contains create-react-app. Now go ahead and manually edit the package.json files to bump the version of create-react-app to 4.0.1 - and afterwards remove it from node modules with rm -rf [hash]/node_modules/create-react-app.

After this if you go back out and try to run npx create-react-app my-app it will prompt you to install 'create-react-app' as normal and should work fine, and now npx will have cached the correct version of 'create-react-app' so you wont have the issue again either. And you can use whichever version of node and npm you like.

If you're on Windows or Mac you have to figure out where the cache is located, as I don't know - but the rest of the steps should be the same.

1

i didn't have any global create-react-app i just did npm uninstall -g create-react-app and then i did npm install create-react-app

Ben Allal
  • 17
  • 1
  • 5
1

I ran into the same problem and the error isn't quite as explanatory as it should be. I fixed it by updating npx itself.

Please type in npm update npxin your terminal to resolve the problem.

After that you can type in npx create-react-app "your preferred project name" to create your react project.

1

Here's what worked for me.

I tried the commands listed in a previous answer. I ran them one by one instead of running them as linked commands in case any of them failed. But I got to the create-react-app command and it failed.

npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f && npx create-react-app my-app

I don't know why, but even after I updated npm and uninstalled globally and cleared the cache, it wouldn't work until I ran

npm i create-react-app

Note: I installed create-react-app without the -g flag. Because as noted by others in this thread, installing create-react-app globally is no longer recommended. Although the other answers are better, if someone makes it to this answer that might be one more thing to take notice of and try.

Patricia Green
  • 495
  • 5
  • 14
1

I've uninstalled create-react-app globally also from yarn

npm uninstall create-react-app -g

And the reinstalled create-react-app

npm i create-react-app

or another way is:

npm create-react-app@latest my-app
npm create-react-app@4.0.2 my-app
1

The other answers didn't work for me. Trying to uninstall globally, for instance, might work to uninstall it but the error persists. It persisted across new installations of Node, and so on.

However, the following seems straightforward and worked for me:

  1. Go into some fresh folder, in which you'll create the app, so that it doesn't already know about create-react-app.
  2. yarn add create-react-app
  3. yarn run create-react-app myapp
josh waxman
  • 191
  • 9
1

SOLUTION:

Step # 1: Remove globally the create-react-app package:

npm uninstall -g create-react-app

Step # 2: Install again globally the create-react-app package:

npm install -g create-react-app

That will install the version 5.0.1 (or higher). To check if it was properly installed, run this on the terminal:

npm list -g

Result:

response on the terminal

And then try again to create the react app, using the sentence:

npx create-react-app <project_name>

And then it will work.

Reinier Garcia
  • 1,002
  • 1
  • 11
  • 19
0

I solved the issue by:

  1. uninstalling node via terminal using home-brew.

  2. Make sure to do a deep clean by using the following commands:

     brew uninstall node; 
     brew cleanup;
     brew uninstall --force node
    
  3. Go to node.js download link and download the stable version package and install it. It should work now.

Shayan Shafiq
  • 1,447
  • 5
  • 18
  • 25
Chris
  • 125
  • 1
  • 7
  • Thanks, this is the best answer IMO. I also did a "brew search node" and then node@14 showed up as the latest stable version in brew. So then "brew install node@14" did the trick. One may also need to update the path, but brew will make it clear if needed: export PATH="/usr/local/opt/node@14/bin:$PATH". Then everything works as expected. – arnold Nov 26 '20 at 18:29
  • I would highly recommend installing NVM as the solution would be as simple as switching to the LTS, running create-react-app and then switching back to the node version you were previously on. – javedb Nov 29 '20 at 00:08
0

This worked for me

npm uninstall -g create-react-app

then

npm install -g create-react-app
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
0

I uninstalled node.js and reinstalled it using windows installer. Now npx create-react-app command works like a charm.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Chandima
  • 2,061
  • 1
  • 13
  • 6
0

One simple solution is to start CMD as administrator and run the usual command:

npx create-react-app myapp
Anton Menshov
  • 2,266
  • 14
  • 34
  • 55
Ashish Saini
  • 190
  • 3
  • 11
0

Simply updating node fixed this issue for me

Sugan
  • 111
  • 1
  • 4
0

After some time trying to fix this the issue is within Yarn. You have to run these scripts to fix this:

npm uninstall -g create-react-app

npm i -g yarn

npx create-react-app my-app
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
joko
  • 39
  • 3
0

Same issue with create-react-app but I had to take a quite different solution approach after trying almost all proposed solutions here...

When npx create-react-app stopped working:

After upgrading nodejs to version 16 on my machine (Windows 10), I kept getting the warning create-react-app version was 4.0.3, which was being the latest version 5.0.0 and that I had to run npm uninstall global create-react-app or yarn remove global create-react-app beacause npx on newer nodejs version already come with create-react-app built in... However, performing the commands above did nothing! I also executed npm cache clean -f and updated npm with npm i -g npm@latest, but still nothing!

Final Solution

Which definately worked for me though was to delete two files (create-react-app.cmd and creat-react-app bin file), propably related to create-react-app being installed globally with yarn! They were located on C:\Users\username\AppData\Local\Yarn\bin on my windows machine...

After performing the global uninstallation of created-react-app with npm and yarn, and then deleting the mentioned files, nxp create react-app my-app started working again!

I hope that help some of you guys too!

Adriano Monecchi
  • 1,135
  • 1
  • 14
  • 34
0

Uninstalling by npm uninstall -g create-react-app or yarn global remove create-react-app didn't work for me.

  • Neither did clearing cache with: npx clear-npx-cache

  • Because get-command create-react-app still showed CRA present globally!

My issue was using different version of Node in NVM:

I had to uninstall CRA for every version of Node.js managed by NVM!

nvm list
nvm use [version]
npm uninstall -g create-react-app   (for every version in the list)
dRaiNe
  • 21
  • 3
0

Maybe you're running an out-of-date version of NodeJS, because that's all your OS offers as a regular package? That was the problem in my case.

TL/DR; the solution: Install the snap version of NodeJS.

Ubuntu 20.04, for instance, currently ships NodeJS v.10.19.0, and I was seeing the exact same error as the original questioner (who didn't specify their OS).

In any case, for me the solution was to first remove the Node package:

$ sudo apt remove nodejs

And, since I already had the Snap environment set up (see https://snapcraft.io if you don't), I installed NodeJS v.16.17.1 using this command:

$ sudo snap install node --classic

If you're using another OS you'll need a different command (e.g. yum, or maybe rpm) to remove the old Node package. The snap command is probably the same for users of any recent OS, with the Snap system installed.

Lambart
  • 1,985
  • 2
  • 21
  • 37
0

Updating the npm fixed the issue for me - npm i -g npm@latest

JohnWick
  • 63
  • 2
  • 8
-1

I had to upgrade to the latest stable version of node using nvm

nvm install [version.number]
nvm use [version.number]
-1

I had to switch to the a previous version of node, using the stable current one didn't work. I switched to 14.

MDShields
  • 75
  • 1
  • 1
  • 4
-1

I was getting this error even with create-react-app uninstalled globally. My npm and node versions were also fine. What worked for me was to:

  1. Install create-react-app locally (without -g)
  2. Then, npx create-react-app my-app in that directory
Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87