I was trying to use create-react-app but I got errors which doesn’t allow me to install new react project. The error is shown below:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx
This message could be even stated in the error message you received:
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.
You must uninstall create-react-app with npm uninstall -g create-react-app
- Uninstall create-react-app v4.0.1
- Globally, update npm, clear the cache, and retry creating the app. Use the command below.
npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f && npx create-react-app@latest my-app --use-npm
Note: Some time this command alone will fix the issue.
Different versions of npm may also be helpful, and you may upgrade using the command below. Please keep in mind that this may have an impact on other projects on your system.