Skip to content

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 #11816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
merryta opened this issue Dec 21, 2021 · 71 comments

Comments

@merryta
Copy link

merryta commented Dec 21, 2021

No description provided.

@chuchude
Copy link

I encountered the same issue. I have tried almost everything. uninstall, clear cache, and use npx create-react-app@5.0.0 but still not working. but the yarn does work. Can anyone help?

@maximarsoficial
Copy link

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
Copy link

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

@chuchude
Copy link

Thank you. I just fixed it by running npm install -g create-react-app@5.0.0

@MrEmanuel
Copy link

MrEmanuel commented Dec 22, 2021

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

@cristiano-belloni
Copy link

@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.

@bchilcott
Copy link

bchilcott commented Dec 23, 2021

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.

@salaadas
Copy link

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

@strongmove
Copy link

strongmove commented Dec 23, 2021

npx clear-npx-cache worked for me.

@MrEmanuel
Copy link

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

@MuhammedMustafaKhan
Copy link

MuhammedMustafaKhan commented Dec 27, 2021

@chuchude Thank you

Her is the solution => Thank you. I just fixed it by running npm install -g create-react-app@5.0.0

@Disha1998
Copy link

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. :(

@tanselberkant
Copy link

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 👍 ❤

@nadlgit
Copy link

nadlgit commented Dec 27, 2021

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

@YousefAlsbaihi
Copy link

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

@marko-hologram
Copy link

Thank you. I just fixed it by running npm install -g create-react-app@5.0.0

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 #11816 (comment)

@cristiano-belloni
Copy link

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

@marko-hologram
Copy link

marko-hologram commented Dec 28, 2021

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.

@cristiano-belloni
Copy link

cristiano-belloni commented Dec 28, 2021

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?

@marko-hologram
Copy link

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.

@cristiano-belloni
Copy link

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?

@marko-hologram
Copy link

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?

@adamflorizone
Copy link

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

@xAt0mZ
Copy link

xAt0mZ commented Dec 28, 2021

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 🚀

@ansherdev
Copy link

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

@marko-hologram
Copy link

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.

@dheeraj-jn
Copy link

dheeraj-jn commented Jan 2, 2022

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 create-react-app@4.0.3 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

@GoloisaNinja
Copy link

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

@oscarcornejo
Copy link

Now CRA projects start with npm and not yarn? 🤔

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

@t0mpl
Copy link

t0mpl commented Feb 17, 2022

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

@t0nghe
Copy link

t0nghe commented Feb 20, 2022

Thank you. I just fixed it by running

I did this instead:

npx create-react-app@5.0.0 my-app-name

@masiafrest
Copy link

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.

@demiladeore
Copy link

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.

@micro9000
Copy link

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

@kellykaufman
Copy link

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 { }

@hrithikhack007
Copy link

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

@adithgit
Copy link

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

@IlyaKrapivnoy
Copy link

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!

@solomonakinbiyi
Copy link

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

@testacode
Copy link

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!

@barhoumikhalil
Copy link

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

@tithidey
Copy link

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

@testacode
Copy link

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')
);

@forkonlyone
Copy link

#11816 (comment)

this woring from my problem, thanks bro 🔥🔥🔥

@gugol2
Copy link

gugol2 commented Apr 27, 2022

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>

@Ahmed546
Copy link

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.

@TimmyDDthe1st
Copy link

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!

@Rallanvila
Copy link

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!

@pastinepolenta
Copy link

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

@alobban
Copy link

alobban commented Jun 22, 2022

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.

@alexn-s
Copy link

alexn-s commented Jul 3, 2022

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

npx create-react-app@5.0.1 ... worked for me

@RLWB
Copy link

RLWB commented Jul 25, 2022

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

@to
Copy link

to commented Oct 12, 2022

npm install create-react-app@4.0.3

edit createReactApp.js around checkForLatestVersion()(line:204) and run

node ./node_modules/create-react-app/index.js <project-name>

@AbdessamieAbdellah
Copy link

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 for me too. Thanks a lot.

@HaoCherHong
Copy link

HaoCherHong commented Nov 14, 2022

took me a while to understand:
If you're trying to run CRA with v4.0.3 configs, you should instead install the latest CRA by

npm install create-react-app@latest

and run following:

 npx create-react-app <app-name> --scripts-version 4.0.3

@junihoj
Copy link

junihoj commented Jan 19, 2023

just use
npx create-react-app@latest <project name>
I guess this is the best way to go.

@Dee4kin
Copy link

Dee4kin commented May 31, 2023

Я исправил эту проблему, изменив версию npm установленной 16.11.1версии. Только что измененная nvmверсия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

Good job bro! Thats worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests