{

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 existing application with 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, run the below command to install the latest version

npm install react-scripts@latest
npm install react@latest
npm install react-dom@latest

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

ReactJS Append variables with strings, jsx state and prop concatenate html

How to display the content of a JSON file in React with example

Reactjs Fix Must call a super constructor in derived class before accessing this

How to change default port in React with create-react-app command?

How to create an react typescript application | Create-react-app typescript application

How to handle broken images in React | fallback for broken images

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