create-react-app is not working since version 4.0.1
Solution 1
This worked for me:
npx create-react-app@latest your-project-name --use-npm
Solution 2
All of the existing answers are incorrect.
According to the create-react-app
docs, create-react-app
should not be installed globally:
If you've previously installed
create-react-app
globally vianpm install -g create-react-app
, we recommend you uninstall the package usingnpm uninstall -g create-react-app
oryarn global remove create-react-app
to ensure thatnpx
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
Solution 3
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 [email protected] app-name
Solution 4
I also faced this issue after they released v4.0.2.
They have mentioned this:
If you've previously installed
create-react-app
globally vianpm install -g create-react-app
, we recommend you uninstall the package usingnpm uninstall -g create-react-app
oryarn global remove create-react-app
to ensure thatnpx
always uses the latest version.
I resolved the issue by following the below steps:
Uninstall
create-react-app
v4.0.1:# for npm: npm uninstall -g create-react-app # for yarn: yarn global remove create-react-app
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
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
Solution 5
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
Related videos on Youtube
Sumanth Hegde
Updated on July 08, 2022Comments
-
Sumanth Hegde almost 2 years
I tried installing
create-react-app
usingnpm i create-react-app
,npx create-react-app new-app
andnpm 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?
-
arnold over 3 yearsThanks, 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.
-
cobrexus over 3 yearsThis answer is incorrect:
create-react-app
should not be installed globally -
cobrexus over 3 years
npm install create-react-app
outside of an npm project doesn't do anything. Just runningnpx create-react-app my-app
will create a new React app. -
cobrexus over 3 years
npm install create-react-app
outside of an npm project doesn't do anything. Just runningnpx create-react-app my-app
will create a new React app. -
javedb over 3 yearsI 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.
-
Alex Hall over 3 years@Λ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.
-
Colorful Tones over 3 years#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! -
Sean256 over 3 yearsI 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. -
Auo about 3 years@Can we use this approach? I am a beginner and not very sure if this will cause any issues in the future?
-
Dashiell Rose Bark-Huss about 3 yearsFirst 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 versionnpm install [email protected]
. 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 thecreate-react-app
package on your computer at all to use the package. -
Dashiell Rose Bark-Huss about 3 yearsWhen 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." -
Suraj Rao about 3 yearsYou dont install globally. Read the answer stackoverflow.com/a/65043610/4826457
-
Mazhar Zandsalimi about 3 yearsI 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?! -
Matt Croak about 3 yearsThis was the only thing that worked for me! It's amazing how many errors can be resolved simply updating/reinstalling packages.
-
Tyler2P almost 3 yearsThere are more detailed answers to answer this question therefore this answer should be a comment instead.
-
Sugan almost 3 yearsNot enough reputations to add it as a comment yet
-
Jo Momma over 2 yearsThis 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
-
Stephen Fong over 2 yearsIf 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. -
Omar Zaoujal over 2 yearsit worked for me too, but honestly, I don't know why it worked because I've installed it globally again
-
Shai Kimchi about 2 yearsHoly crap, after doing "yarn add create-react-app" "npx create-react-app" started working again!!! tnx
-
Maka Idfu about 2 yearsI get a "permission denied" when I try to run this command even with sudo before it
-
cobrexus about 2 years@MakaIdfu that means that you are not logged in as the super user on your machine...
-
Brandon Johnson almost 2 years
clear the cache
is the important piece i was missing thanks