Open gitpushdashf opened 2 years ago
I had the same issue, the solution that worked for me is to clear the cache
npm cache clean --force
but wait for it to clear, the clearing process will not show you a loading bar of cleaning, so you may think it is not responding and ( ctr c ) the process, I was doing that, Then try again
npx create-react-app projectName
If still not working try
npx clear-npx-cache
then
npm cache clean --force
That may well solve some issues, but I don't think it's the one here. I'm standing up fresh Docker containers (so no NPM cache) and am getting an error message trying to run CRA 4.0.3, where older versions of CRA are explicitly blocked.
Me too, I was trying to use latest CRA but storybook and other libraries don't work with react 18 yet so when trying to use CRA4 got the same error, I have cleaned all npx, yarn and npm caches and also uninstalled any global dependency and still doesn't work. Please help!
I had the same issue, the solution that worked for me is to clear the cache
npm cache clean --force
but wait for it to clear, the clearing process will not show you a loading bar of cleaning, so you may think it is not responding and ( ctr c ) the process, I was doing that, Then try again
npx create-react-app projectName
If still not working try
npx clear-npx-cache
then
npm cache clean --force
This just installs the latest version which comes with latest react version (18), not suitable for me. I need version 17.
I had the same issue, the solution that worked for me is to clear the cache
npm cache clean --force
but wait for it to clear, the clearing process will not show you a loading bar of cleaning, so you may think it is not responding and ( ctr c ) the process, I was doing that, Then try again
npx create-react-app projectName
If still not working try
npx clear-npx-cache
then
npm cache clean --force
This just installs the latest version which comes with latest react version (18), not suitable for me. I need version 17.
We created a custom template that needs react version 17, but CRA does not provide mechanisms to fix react and react-dom versions
I tried using CRA4 with
npx create-react-app@4.0.3 test-CRA
but that simply gives this error
You are running `create-react-app` 4.0.3, which is behind the latest release
(5.0.1).
We no longer support global installation of Create React App.
I don't understand why they try so hard to not allow you to use an old version. Tons of use cases and people need React 17 instead of React 18. And making a fresh app with CRA4 is much more stable than making one with CRA5 and downgrading React versions manually
I tried using CRA4 with
npx create-react-app@4.0.3 test-CRA
but that simply gives this error
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.1). We no longer support global installation of Create React App.
I don't understand why they try so hard to not allow you to use an old version. Tons of use cases and people need React 17 instead of React 18. And making a fresh app with CRA4 is much more stable than making one with CRA5 and downgrading React versions manually
In another answer, I saw that using yarn create react-app new-app --template typescript --scripts-version 4.0.3
can install the specified version of react-scripts, but cannot specify the react version
I want to install version 4.0.3 because that's the version in use by our large app. I want to install the exact same version in a new, bare project to experiment with our create-react-app configuration.
I've tried the npx clear-npx-cache
suggestion in the diff of #12891 , but it didn't help.
The npx cache is empty: ls -la ~/.npm/_npx # => empty
The easiest way to run an old version of create-react-app
is to install the desired version (npm install create-react-app@4.0.3
) and suppress the version check.
Edit node_modules/create-react-app/createReactApp.js
, change line 204 from:
if (latest && semver.lt(packageJson.version, latest)) {
to:
if (false) {
If I needed to automate this (such as in CI), I would just run sed
after npm install ...
and be done.
From a node:17-alpine Docker image:
It would be very handy to be able to use 4.0.3 while 5.0.X issues are worked out.