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

Today, when I am creating react application, it got an error.

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

Fixing for running create-react-app 4.0.3, which is behind the latest release (5.0.0)

In my System, I created a react application with the below command

A:\work>npx create-react-app kend-react-examples
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/

React application is not created, instead, it throws an error.

There are two versions with local create-react-app installation and npx create-react-app mismatched in my system.

It suggested removing the global installation

I tried to uninstall with the below command

npm uninstall -g create-react-app

Again, Created an application and got the same error.

uninstall globally command does not fix my issues alone.

Then, How do you fix the issues?

There are multiple ways to fix this.

The first way is to clear the npx global cache and get the latest package and run

npm uninstall -g create-react-app
npx clear-npx-cache
npx create-react-app kendo-react-app

The above command does

  • uninstall create-react-app CLI globally
  • npx clear cache
  • create a react application

With the above steps, it works, if it does not work, try the second approach below mentioned.

Another way is to run npx with the latest package using the force option

npx create-react-app@latest kendo-react-appp --use-npm

Now, Create react application and it works as given below

A:\work>npx create-react-app kend-react-examples
Need to install the following packages:
  create-react-app
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.

Creating a new React app in A:\work\kend-react-examples.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


added 1370 packages in 5m

169 packages are looking for funding
  run `npm fund` for details

Initialized a git repository.

Installing template dependencies using npm...
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated

added 38 packages in 24s

169 packages are looking for funding
  run `npm fund` for details
Removing template package using npm...


removed 1 package, and audited 1408 packages in 10s

169 packages are looking for funding
  run `npm fund` for details

8 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Created git commit.

Success! Created kend-react-examples at A:\work\kend-react-examples
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    , and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd kend-react-examples
  npm start

Happy hacking!

Conclusion

In a summary, learned how to fix an error You are running create-react-app 4.0.3, which is behind the latest release (5.0.0) in React.