create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

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 Ap

Open merryta opened this issue 3 years ago • 71 comments

merryta avatar Dec 21 '21 12:12 merryta

I encountered the same issue. I have tried almost everything. uninstall, clear cache, and use npx [email protected] but still not working. but the yarn does work. Can anyone help?

chuchude avatar Dec 21 '21 14:12 chuchude

Hello, I just came across this problem, and I found that with this I could solve it

npx create-react-app@latest {project name}

maximarsoficial avatar Dec 21 '21 14:12 maximarsoficial

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)

npm uninstall -g create-react-app

we uninstall it and then I reinstall it npm install -g create-react-app

and voila, it worked for me

maximarsoficial avatar Dec 21 '21 14:12 maximarsoficial

Thank you. I just fixed it by running npm install -g [email protected]

chuchude avatar Dec 21 '21 14:12 chuchude

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)

npm uninstall -g create-react-app

we uninstall it and then I reinstall it npm install -g create-react-app

and voila, it worked for me

I would advice against installing npm packages globally. Thus I would recommended that you instead do:

npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app my-app

This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html

npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx

Edit: Thanks to @strongmove for suggesting to add npx clear-npx-cache

MrEmanuel avatar Dec 22 '21 10:12 MrEmanuel

@MrEmanuel, the problem is that

npm uninstall -g create-react-app

does not solve the 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 message that gives the title to this ticket.

cristiano-belloni avatar Dec 22 '21 12:12 cristiano-belloni

So this is what happens when running npx create-react-app as recommended, even after uninstalling globally.

PS C:\Repos> npx create-react-app my-app
Need to install the following packages:
  create-react-app
Ok to proceed? (y) y

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

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
PS C:\Repos>

The solution as mentioned above is to just use npx create-react-app@latest, but it's definitely a strange problem. I'm using a fresh installation of node and npm here. I'm running on Windows through PowerShell.

bchilcott avatar Dec 23 '21 03:12 bchilcott

I have encountered this issue last week and my take is npm_config_yes=true create-react-app my-app@latest

salaadas avatar Dec 23 '21 09:12 salaadas

npx clear-npx-cache worked for me.

strongmove avatar Dec 23 '21 11:12 strongmove

I updated my answer to include the command do clear the cache as per the comment from @strongmove

MrEmanuel avatar Dec 23 '21 14:12 MrEmanuel

@chuchude Thank you

Her is the solution => Thank you. I just fixed it by running npm install -g [email protected]

MuhammedMustafaKhan avatar Dec 27 '21 06:12 MuhammedMustafaKhan

Thank you ..! Cant you please let me know that how to ren the project ?

--> I tried " react-scripts start " this but cant run the program. :(

Disha1998 avatar Dec 27 '21 09:12 Disha1998

Thank you so much

dreamlancer avatar Dec 27 '21 14:12 dreamlancer

Hello, I just came across this problem, and I found that with this I could solve it

npx create-react-app@latest {project name}

it works thanks 👍 ❤

tanselberkant avatar Dec 27 '21 18:12 tanselberkant

Hello, I just came across this problem, and I found that with this I could solve it

npx create-react-app@latest {project name}

Thank you so much

nadlgit avatar Dec 27 '21 20:12 nadlgit

just run

Uninstall create-react-app by running this code in your terminal

npm uninstall -g create-react-app

After uninstall done, install it again npm install -g create-react-app

to test npx create-react-app app-name

YousefAlsbaihi avatar Dec 28 '21 06:12 YousefAlsbaihi

Thank you. I just fixed it by running npm install -g [email protected]

Please avoid doing this. As mentioned in the docs (https://github.com/facebook/create-react-app#quick-overview), it is preferred to always run create-react-app directly with npx so that you always use the latest version instead of using a globally installed version. Of course, you need to uninstall any globally installed CRA version on your machine before trying it with npx.

This answer here is better in general https://github.com/facebook/create-react-app/issues/11816#issuecomment-999470005

marko-hologram avatar Dec 28 '21 11:12 marko-hologram

Of course, you need to uninstall any globally installed CRA version on your machine before trying it with npx.

@marko-hologram the whole point of this issue report is that uninstalling the old CRA globally does not work for some people and the error message is seen even after uninstalling

cristiano-belloni avatar Dec 28 '21 11:12 cristiano-belloni

Of course, you need to uninstall any globally installed CRA version on your machine before trying it with npx.

@marko-hologram the whole point of this issue report is that uninstalling the old CRA globally does not work for some people and the error message is seen even after uninstalling

Yes I understand that. There are potentially cases where people somehow have CRA installed globally in multiple places and they should uninstall it in multiple places potentially. I wanted to point out that installing the package globally doesn't really fix the issue and isn't the ideal solution going forward 😄

If people would follow the docs initially they wouldn't even have CRA installed globally (since docs suggest you shouldn't have global installs) and would avoid all of these issues altogether.

marko-hologram avatar Dec 28 '21 11:12 marko-hologram

If people would follow the docs initially they wouldn't even have CRA installed globally (since docs suggest you shouldn't have global installs) and would avoid all of these issues altogether.

Yes, but those people are not reading this bug report because CRA works for them. The people for whom this bug report is useful are people who had installed CRA globally and now find that uninstalling it globally, as advised by the CLI, doesn't work. You're telling them that they should try to uninstall it (they already tried) and that they shouldn't have installed it globally in the first place (they can't change the past). How does it help?

cristiano-belloni avatar Dec 28 '21 12:12 cristiano-belloni

If people would follow the docs initially they wouldn't even have CRA installed globally (since docs suggest you shouldn't have global installs) and would avoid all of these issues altogether.

Yes, but those people are not reading this big report. The people for whom this bug report is useful there are people who installed CRA globally and find that uninstalling it globally, as advised by the CLI, doesn't work. You're telling them that they should try to uninstall it (they already tried) and that they shouldn't have installed it globally in the first place (they can't change the past). How does it help?

I'm trying to suggest to them to actually take time and try to fix the underlying issue completely. Most of these GitHub issues I've seen here where people have trouble bootstrapping a CRA project are caused by a global install of CRA. So by taking a bit of time and fixing the issue they will make it easier for maintainers and for themselves in the long run. Re-installing it as global dependency is a temporary fix that will bite them in the ass later again and they will come here again and open another issue unnecessarily.

marko-hologram avatar Dec 28 '21 12:12 marko-hologram

I'm trying to suggest to them to actually take time and try to fix the underlying issue completely.

Yet you don't mention how: you merely point them to a comment that tells them to uninstall the global CRA and clear the npx cache, which is what this user tried in the second post, without success. Again, how does this help?

cristiano-belloni avatar Dec 28 '21 12:12 cristiano-belloni

Yet you don't mention how

Because I cannot pinpoint which of the possible fixes might apply to them. I'm at least trying to steer them in the right direction in order to find the solution instead of applying a temporary fix.

and clear the npx cache, which is what this user tried in the second post, without success. Again, how does this help?

That person didn't specifically mention that they cleared npx cache, maybe they only cleared npm cache?

marko-hologram avatar Dec 28 '21 12:12 marko-hologram

I fixed this issue without running any scripts.

$ npx create-react-app my-app
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.

I ended up doing this to clear cache under Ubuntu:

$ npm config get cache
/home/myuser/.npm

$ rm -r /home/myuser/.npm

$ sudo npm config get cache
/root/.npm

$ sudo rm -r /root/.npm

The result was:

$ npx create-react-app my-app
....
Success! Created my-app at /home/myuser/Documents/my-app

TLDR:

Clear both root and user npm cache

$ sudo rm -r ~/.npm /root/.npm

adamflorizone avatar Dec 28 '21 18:12 adamflorizone

Clearing npx cache solves the issue for me (no global install) If npx clear-npx-cache doesn't solve the issue, you can manually remove <CACHE_ROOT>/_npx folder.

CACHE_ROOT can be found with npm config get cache

For more details, <CACHE_ROOT>/_npx folder contains subfolders with an ID format. One of these (linked to the user ? mine contained multiple) contains a package.json, which should include

{
  "dependencies": {
    "create-react-app": "^4.0.3"
  }
}

EDIT: Adam's answer is definitely the B plan if npx script doesn't work : manually nuke npx cache folder :rocket:

xAt0mZ avatar Dec 28 '21 18:12 xAt0mZ

I fixed this issue by changing the version of the npm I had the 16.11.1 version installed. Using nvm I just changed the version to 14.18.1

> node -v
v16.11.1

> nvm use 14
Now using node v14.18.1 (npm v6.14.15)

> npx create-react-app my-app

ansherdev avatar Dec 28 '21 19:12 ansherdev

I fixed this issue by changing the version of the npm I had the 16.11.1 version installed. Using nvm I just changed the version to 14.18.1

> node -v
v16.11.1

> nvm use 14
Now using node v14.18.1 (npm v6.14.15)

> npx create-react-app my-app

I'm guessing this works because different node versions that are managed by NVM have their own separate caches and install locations? If you go back to your v16.11.1 it potentially won't work again and one of the solutions in these comments could work for you. Just so that you aren't always stuck on Node v14.

marko-hologram avatar Dec 29 '21 08:12 marko-hologram

None of the above listed solutions work for me, when trying to install v4.0.3 of create-react-app.

I don't have CRA globally installed in neither npm nor yarn. Nuking npm cache folder did not help.

$ npx [email protected] my-app
npx: installed 67 in 3.79s

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

dheeraj-jn avatar Jan 02 '22 08:01 dheeraj-jn

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one) npm uninstall -g create-react-app we uninstall it and then I reinstall it npm install -g create-react-app and voila, it worked for me

I would advice against installing npm packages globally. Thus I would recommended that you instead do:

npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app my-app

This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html

npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx

Edit: Thanks to @strongmove for suggesting to add npx clear-npx-cache

Clearing the cache via npx clear-npx-cache worked for me as well

GoloisaNinja avatar Jan 02 '22 20:01 GoloisaNinja

Now CRA projects start with npm and not yarn? 🤔

Captura de Pantalla 2022-01-06 a la(s) 00 23 47

oscarcornejo avatar Jan 06 '22 03:01 oscarcornejo

Now CRA projects start with npm and not yarn? 🤔

Captura de Pantalla 2022-01-06 a la(s) 00 23 47

CRA now uses the package manager that you used to create the project instead of just defaulting to Yarn. https://create-react-app.dev/docs/getting-started#selecting-a-package-manager https://github.com/facebook/create-react-app/releases/tag/v5.0.0

marko-hologram avatar Jan 06 '22 21:01 marko-hologram

Ok. So how do we use version 4.0.3 though? We cannot switch to Node 14 for... reasons.

update

If you want to run the previous version, npx create-react-app --scripts-version 4.0.3

halfnibble avatar Jan 07 '22 05:01 halfnibble

I tried every suggestion here to no avail. I'm using asdf to manage node (but didn't always) so my local env is probably borked.

Hacky Solution

  1. APP_NAME=my-app

  2. Make the app directory on your host machine

    • mkdir $APP_NAME
    • cd $APP_NAME
    • full path is /Users/kylesteger/apps/my-app
  3. Build the docker image provided below

    • docker build -t react-app-builder --build-arg APP_NAME=$APP_NAME -f react-app-builder.dockerfile .
  4. Run the image with the current directory mounted to the container dir

    • docker run -v $(pwd):/$APP_NAME react-app-builder:latest npx create-react-app $APP_NAME
  5. Back on your host run npm start

    • there's a non zero chance that you'll need to blow away node_modules locally and reinstall
FROM ubuntu
ARG APP_NAME

RUN apt update && \
    apt install -y curl git && \
    curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \
    bash nodesource_setup.sh && \
    apt install nodejs

RUN mkdir ${APP_NAME}

kyleVsteger avatar Jan 07 '22 19:01 kyleVsteger

I came across same problem this fixed it thank you YousefAlsbaihi

just run

Uninstall create-react-app by running this code in your terminal

npm uninstall -g create-react-app

After uninstall done, install it again npm install -g create-react-app

to test npx create-react-app app-name

steven-halla avatar Jan 09 '22 08:01 steven-halla

I came across same problem this fixed it thank you YousefAlsbaihi

just run

Uninstall create-react-app by running this code in your terminal

npm uninstall -g create-react-app

After uninstall done, install it again

npm install -g create-react-app

to test

npx create-react-app app-name

Hey Steven - glad you're up and running - just be aware the docs no longer recommended having CRA globally installed. Did you try to uninstall the global then run an npx-clear-cache? Just curious.

GoloisaNinja avatar Jan 09 '22 08:01 GoloisaNinja

I had to run npm uninstall -g create-react-app npm uninstall create-react-app npx clear-npx-cache

in order for it to work I think for those of you having the same error after uninstalling globally, you should try uninstalling locally as well

kapasinh avatar Jan 12 '22 06:01 kapasinh

I came across this problem and tried everything suggested here with no success. I am using NPM, but I just happened to remember using Yarn for a while earlier. Tried running the remove command for that as well and it solved the problem!

So, if you have tried everything else suggested here and have ever used both NPM and Yarn, don't overlook running both uninstall commands like I did at first.

kallerouvinen avatar Jan 12 '22 17:01 kallerouvinen

I had the same issue but I tried this and it works: type this in your command

npx clear-npx-cache

then try to create a new project again.

amalikmuhd avatar Jan 16 '22 04:01 amalikmuhd

npx clear-npx-cache

Clearing the cache was the correct solution. Using npx create-react-app@latest project also worked for me.

lazakoa avatar Jan 19 '22 00:01 lazakoa

Hello, I just came across this problem, and I found that with this I could solve it

npx create-react-app@latest {project name}

It worked. Thank you.

cleargoaldigital avatar Jan 21 '22 00:01 cleargoaldigital

For those, like me, where none of the solutions mentioned in this forum worked here is another solution that fixed it right away: delete your entire node_modules folder. Then run the npx create-react-app my-app

musicjoeyoung avatar Jan 24 '22 18:01 musicjoeyoung

I encountered the same issue. I have tried almost everything. uninstall, clear cache, and use npx [email protected] but still not working. but the yarn does work. Can anyone help?

use the command npx create-react-app@5 . if you are inside project folder or npx create-react-app@5 <PROJECT_NAME> if you are outside the project folder. Use @5 only instead of @5.0.0 and it should work

enigma6174 avatar Jan 25 '22 09:01 enigma6174

npx clear-npx-cache

This solved my problem, and according to the documentation seems like the optimal way. Thank you very much

isaacr393 avatar Feb 06 '22 04:02 isaacr393

I had to run npm uninstall -g create-react-app npm uninstall create-react-app npx clear-npx-cache

This is the only thing that worked for me.

ten9inc avatar Feb 17 '22 04:02 ten9inc

the new version is working terrible with web3, why prevent the use of previous version?

t0mpl avatar Feb 17 '22 08:02 t0mpl

Thank you. I just fixed it by running

I did this instead:

npx [email protected] my-app-name

t0nghe avatar Feb 20 '22 16:02 t0nghe

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one) npm uninstall -g create-react-app we uninstall it and then I reinstall it npm install -g create-react-app and voila, it worked for me

I would advice against installing npm packages globally. Thus I would recommended that you instead do:

npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app my-app

This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html

npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx

Edit: Thanks to @strongmove for suggesting to add npx clear-npx-cache

this work for me.

masiafrest avatar Feb 23 '22 21:02 masiafrest

I had to run npm uninstall -g create-react-app npm uninstall create-react-app npx clear-npx-cache

in order for it to work I think for those of you having the same error after uninstalling globally, you should try uninstalling locally as well

This worked for me.

demiladeore avatar Feb 25 '22 09:02 demiladeore

Since they no longer support the global installation of Create React App. just uninstall it globally:

npm uninstall -g create-react-app
npx clear-npx-cache

Then install locally (root of your project):

npm install create-react-app

Then just create new app using the create-react-app

micro9000 avatar Mar 05 '22 14:03 micro9000

Hello, I just came across this problem, and I found that with this I could solve it

npx create-react-app@latest {project name}

This worked when I removed the { }

kellykaufman avatar Mar 15 '22 19:03 kellykaufman

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)

npm uninstall -g create-react-app

we uninstall it and then I reinstall it npm install -g create-react-app

and voila, it worked for me

hrithikhack007 avatar Apr 06 '22 22:04 hrithikhack007

For me, 'npm uninstall -g create-react-app' did the job. Then -> npx create-react-app project-name . Hope this works.

adithgit avatar Apr 13 '22 04:04 adithgit

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one)

npm uninstall -g create-react-app

we uninstall it and then I reinstall it npm install -g create-react-app

and voila, it worked for me

Worked for me as well!

IlyaKrapivnoy avatar Apr 13 '22 19:04 IlyaKrapivnoy

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one) npm uninstall -g create-react-app we uninstall it and then I reinstall it npm install -g create-react-app and voila, it worked for me

I would advice against installing npm packages globally. Thus I would recommended that you instead do:

npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app my-app

This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html

npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx

Edit: Thanks to @strongmove for suggesting to add npx clear-npx-cache

It worked!!!! Awesome advice

solomonakinbiyi avatar Apr 17 '22 15:04 solomonakinbiyi

Ok. So how do we use version 4.0.3 though? We cannot switch to Node 14 for... reasons.

update

If you want to run the previous version, npx create-react-app --scripts-version 4.0.3

This super works for me as I don't want to use latest version (5.x.x). Thanks!

testacode avatar Apr 23 '22 17:04 testacode

this fix the issue for me:

  1. Run cmd as admin
  2. yarn global remove create-react-app
  3. then I create my app.. npx create-react-app my-app --template [template-name]

hope this will help

barhoumikhalil avatar Apr 25 '22 15:04 barhoumikhalil

Just a quick suggestion which able to fix this issue. First of all I tried to clear cache using npx clear cache. (Not worked) Solution: 1: uninstall the nodejs 2: C:\Users\username\AppData\Roaming\npm -> delete this npm folder 3: C:\ProgramData\npm-cache -> delete this npm-cache 4: Find if any other npm folder is exist or not inside of C:\Program Files. If exist the delete it.

  1. Now install nodejs again.
  2. npx create-react-app myapp

that's it

tithidey avatar Apr 25 '22 16:04 tithidey

My solution was just installing latest and downgrading react version in the app.

1 - npx create-react-app@latest <app-name> 2 - npm install react@17 react-dom@17 @testing-library/react@12 @testing-library/user-event@12

and then in the index.js from the root directory:

import ReactDOM from 'react-dom/client';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

to

import ReactDOM from 'react-dom';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

testacode avatar Apr 25 '22 17:04 testacode

https://github.com/facebook/create-react-app/issues/11816#issuecomment-998811990

this woring from my problem, thanks bro 🔥🔥🔥

airdropdrone avatar Apr 26 '22 14:04 airdropdrone

Ok. So how do we use version 4.0.3 though? We cannot switch to Node 14 for... reasons.

update

If you want to run the previous version, npx create-react-app --scripts-version 4.0.3

This answer was awesome!

And just for the sake of making it super easy (and if you want typescript in your project):

npx create-react-app --scripts-version 5.0.0 --template typescript <your-project-name>

gugol2 avatar Apr 27 '22 16:04 gugol2

I tried everything then use these commands npm uninstall -g create-react-app then npm install -g create-react-app and it works for me.

Ahmed546 avatar Apr 30 '22 10:04 Ahmed546

Also what one can do is enter the console as administrator, located in the user's folder, and put this command (in my case I used the NPM one) npm uninstall -g create-react-app we uninstall it and then I reinstall it npm install -g create-react-app and voila, it worked for me

I would advice against installing npm packages globally. Thus I would recommended that you instead do:

npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app my-app

This is the preferred installation method according to the react docs. https://reactjs.org/docs/create-a-new-react-app.html

npx is included in newer versions of npm and you shouldn't need to install it. Read more about npx here: https://www.npmjs.com/package/npx

Edit: Thanks to @strongmove for suggesting to add npx clear-npx-cache

This fixed it for me!

TimmyDDthe1st avatar May 04 '22 15:05 TimmyDDthe1st

Hello, I just came across this problem, and I found that with this I could solve it

npx create-react-app@latest {project name}

This worked perfectly for me!

Rallanvila avatar Jun 14 '22 14:06 Rallanvila

Even npx create-react-app --scripts-version 4.0.3 does not work for me. I get:

You are running Node 12.13.0.
Create React App requires Node 14 or higher. 
Please update your version of Node

I currently don't have a way to run CRA version 4 with node 12

pastinepolenta avatar Jun 15 '22 06:06 pastinepolenta

Even npx create-react-app --scripts-version 4.0.3 does not work for me. I get:

You are running Node 12.13.0.
Create React App requires Node 14 or higher. 
Please update your version of Node

I currently don't have a way to run CRA version 4 with node 12

I am running Node 16.15.0 and still no joy. So upgrading wouldn't help.

alobban avatar Jun 22 '22 18:06 alobban

just encountered this issue npx clear-npx-cache & uninstalling globally does not work for me.

npx [email protected] ... worked for me

alexn-s avatar Jul 03 '22 18:07 alexn-s

If npm uninstall -g create-react-app not working; please use yarn global remove create-react-app worked for me.

RLWB avatar Jul 25 '22 14:07 RLWB