{

How to update ReactJS's `create-react-app`?


I started to create a react application with the npx create-react-app command and it gives an error You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).

It means, My system uses create-react-app with the old version 4.0.4 and the latest version is 5.0.0.

It does not create an application, So I have to upgrade to the latest version.

here is an output of npx create-react-app command

A:\work>npx create-react-app react-style-components
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 the 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/

Why update create-react-app is required?

create-react-app is a CLI tool to create a brand new react application with all latest react and dependencies versions.

If you are using the old version, It creates a react-application with old react-script and dependent libraries (babel, webpack) versions.

There are multiple ways to install the create-react-app CLI with the latest version.

  • uninstall and install create-react-app with the latest version
  • Upgrade the existing application with a recent version.

How to update create-react-app to the latest version

Following are steps to upgrade

First, In Terminal, run the below command to uninstall create-react-app globally

npm uninstall -g create-react-app

Now, You can install globally using the below command

 npm install -g create-react-app

Next, run the below command to create a react application which creates an application with all the latest versions.

npx create-react-app appname

How to upgrade the existing react application version to the latest?

If you have an application created with create-react-app with the old version.

Following are steps to upgrade the latest react dependencies.

create-react-app has the following minimal dependencies

  • react-scripts development dependencies, provides start/stop scripts for react application
  • react
  • react-dom dependency

Go to the application folder, and run the below command to install the latest version

npm install [email protected]
npm install [email protected]
npm install [email protected]

Conclusion

In summary, You learned how to upgrade create-react-app to the latest version Creating a new react application with the latest version existing react application to upgrade to the latest version.

THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.





Related posts

Basic React Interview questions and answers

Best ways to add an element to an array in React state with examples

Difference between Development and Production Builds in React

Difference between pureComponent and component in React

Difference between super and super props in React constructor class?

Fixing an error You are running create-react-app 4.0.3, which is behind the latest release (5.0.0) in React

Getting started with ReactJS Bootstrap Tutorials with examples | reactstrap tutorials