'While creating a react app I'm getting following error or errors

I ran create-react-app and get this error message I did the followings like uninstalling global and so no but getting the same again and again.

You are running `create-react-app` 4.0.0, which is behind the latest release (4.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 ERR! code 1
npm ERR! path J:\Akhlak_hossain_jim
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""create-react-app" "ahj-app" "--use-npm""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Akhlak Hossain Jim\AppData\Local\npm-cache\_logs\2020-11-24T15_16_27_423Z-debug.log

Edit:

I've also tried the following:

  1. Using npx instead. - but that's not working and is showing the above error message.

  2. Uninstalled create-react-app using npm uninstall -g create-react-app before running npx create-react-app ahj-app - however that also doesn't work.



Solution 1:[1]

npm install -g create-react-app

Above worked for me.

Solution 2:[2]

Do not use npm to install "create-react-app" instead use npx this way:

npx create-react-app my-app

it will always use the lastest version

Solution 3:[3]

I solved this using the following command.

npm uninstall -g create-react-app

then again install

npm install -g create-react-app

PS D:\ReactProjects> npx create-react-app sample-app

Creating a new React app in D:\ReactProjects\sample-app.

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

Solution 4:[4]

npx [email protected] ahj-app

Specify the latest version explicitly when creating new app

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mayuresh Srivastava
Solution 2 Ariel Batista
Solution 3 Rishav.7
Solution 4 DK_bhai