Create-React-App Is Not Working Since Version 4.0.1
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...
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?
38 Answers
This worked for me:
npx create-react-app@latest your-project-name --use-npm
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-appglobally vianpm install -g create-react-app, we recommend you uninstall the package usingnpm uninstall -g create-react-apporyarn global remove create-react-appto ensure thatnpxalways 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
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
I also faced this issue after they released v4.0.2.
They have mentioned this:
If you've previously installed
create-react-appglobally vianpm install -g create-react-app, we recommend you uninstall the package usingnpm uninstall -g create-react-apporyarn global remove create-react-appto ensure thatnpxalways uses the latest version.
I resolved the issue by following the below steps:
Uninstall
create-react-appv4.0.1:# for npm: npm uninstall -g create-react-app # for yarn: yarn global remove create-react-appYou are not required to install
create-react-appin 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 (-gor--global) using the below command:# for npm: npm i create-react-app # for yarn: yarn add create-react-appYou 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
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
Updating NPX worked for me. Suggestions on this page didn't do the trick but might have contributed.
npm update npx
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
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.
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.
After create-react-app > 4.0.1 use these commands
Must Read
npm
npm init react-app my-app