Skip to content

Not able to use create-react-app 4.0.3 #12282

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
gitpushdashf opened this issue Apr 12, 2022 · 8 comments
Open

Not able to use create-react-app 4.0.3 #12282

gitpushdashf opened this issue Apr 12, 2022 · 8 comments

Comments

@gitpushdashf
Copy link

From a node:17-alpine Docker image:

/ # npx [email protected] test
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

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.

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 notice
npm notice New minor version of npm available! 8.5.5 -> 8.6.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.6.0
npm notice Run npm install -g [email protected] to update!
npm notice

It would be very handy to be able to use 4.0.3 while 5.0.X issues are worked out.

@al-amiir
Copy link

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  

@gitpushdashf
Copy link
Author

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.

@testacode
Copy link

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!

@testacode
Copy link

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.

@dsv-sergey
Copy link

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

@JRebella
Copy link

I tried using CRA4 with

npx [email protected] 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

@hsbtr
Copy link

hsbtr commented Nov 2, 2022

I tried using CRA4 with

npx [email protected] 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

@richardkmichael
Copy link

richardkmichael commented Feb 8, 2023

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 [email protected]) 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.

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

No branches or pull requests

7 participants