create-react-app: We no longer support global installation of Create React App
Describe the bug
I’m not comfortable with all of the critical bugs in the recently released CRA 5.0.0, so want to use the most recent reliable v4 instead, 4.0.3.
Can’t use npx create-react-app any more due to following error.
user:~/my-dir$ npx create-react-app@4.0.3 my-new-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.
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/
npm version: 8.1.0
Steps to reproduce
Try creating a new react app using CRA.
npx create-react-app@4.0.3 your-new-app- Get above error, app not created.
- Try removing global install as per the given instructions with
npm uninstall -g create-react-app - Has no effect.
Expected behavior
Should create a new CRA app. Should not care about latest release.
Actual behavior
Error.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 30
- Comments: 33
You mean this one
I had a same problem and this has solved the problem. but should be working without designating version or latest in the future I hope.
It’s not an error it’s just a warning. Facebook suggests to use latest version of CRA for creating apps. Use this instead
For more info refer to this stack overflow question
I got the same error even when doing simply:
Then I tried:
Same error again.
The only way I was able to get cra working at all was via the following command:
False. It fails to “create a react app”. Therefore, it is an error.
I solved this problem with this command:
npx clear-npx-cacheThen try this
npm i -g create-react-app@<version>Then in your folder where you want to create the application
create-react-app <app-name>This should work
Possibly related to: https://github.com/facebook/create-react-app/issues/10601 and https://github.com/npm/cli/issues/2329
Also helpful:
npx clear-npx-cache(This fixed the issue for me: I no longer have to specify@latestto get the command to work.)(Though, I guess this does not fix the original issue the OP was interested in, which was CRA not allowing a version prior to
latestto work.)If nothing else works for you:
npm initin it (use w/e data you want, this is throw-away directory)npm install create-react-app@4.0.3node_modules/create-react-app/createReactApp.jsfind lineif (latest && semver.lt(packageJson.version, latest)) {and change it toif (false && latest && semver.lt(packageJson.version, latest)) {create-react-app my-app --template typescript --use-npm(customize what you need)npm run setupIt looks from the source code that trying to use any version but the latest version errors out.
Maintainers: could we at least get an appropriate error message if the problem is trying to use an unsupported version? Or possibly allow installing with an older version of CRA, with a warning?
It won’t work even if you install create-react-app as an npm package in a separate project and try to run it from there.
However there can be cases that require
craof versions lower than 5.x, i.e. when you attempt to migrate an application from custom webpack config tocreate-react-appand aiming for 5.x introduces significant breaking changes.Please don’t burn the bridges for those who can’t jump to the latest 5.x cra 😃
I got this issue too. I did what @adimshev said with clear cache and it worked. I was promted to install create-react-app@5.0.1 after clearing cache and running npx cra again. Now all subsequence npx create-react-apps also work fine!
Is there a way to skip this error and force running a certain version of CRA instead of installing the latest one?
npx clear-npx-cache
I’ll definitely be typing npx create-react-app@latest my-app until they figure this out lol.
I’ll add to the chorus that this is completely uncool.
I received the same wrong error message following the wrong instructions that CRA publishes for “getting started”.
npx clear-npx-cachesolved the problem. I had no, absolutely zero, packages installed globally with npm, I don’t need to get gaslighted with incorrect error messages.In this case I am putting together a toy application to debug a problem (not really React-related) with a large React application and CRA is potentially a big help if it can save time setting up. I guess for work I’d have to set the whole thing up manually with CRA and I probably would have, but if it was a side project I’d seriously think about ditching React for Svelte or somebody else who attends to having correct instructions for the most critical operation (getting started).
I am really getting tired of all the problems of CRA, and still it keeps surprising me. The latest version creates apps with react 18, which might be an issue for many reasons. And now they don’t even allow using older versions? Or options to select the react version to use? This is simply absurd. I work in programming education and I am really going to consider switching to another approach, no more recommending students to use this.
I think, that problem is deeper. There is no stable version in cra. We have only latest, but it’s not stable. For example, I create app from latest and gave react 18. But storybook does not support react 18 yet. Storybook is commonly used, and it’s not good just ignore that case. I don’t think that is stable version, if I have to patch verisons in my final package.json.
Also I have my own template, that use my company. I’m very frustrating, when I cannot create new app. lastest cra break compatibility with common tools and have no possibility to install previous more stable version.
I suggest to support two versions - stable and latest. In that case maintainers don’t have to support all possible versions of cra, but only two. If users of cra are getting errors with latest, they have stable version, that ok.
Stable version should support all common used tools like storybook by scratch.
Thanks man, this works. However, it’s crazy that we need to do this to use an older version