I was trying to create a new React app with the following command.
> npx create-react-app react-app
Then I get the following error:
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.1).
We no longer support global installation of Create React App.
I also get some help instructions as well as:
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
I tried to run the floowing command multiple times as suggested:
> npm uninstall -g create-react-app
Which ran fine with no error that means my create-react-app glabal installation uninstalled successfully. Then I again tried the same command to install the React app:
> npx create-react-app react-app
But I again get the same errors and suggestions. I repeated the same procedure multiple times but it did not work. Then I decided to look for the solution over a search engine. By no much time, I got some useful help that suggested me to clear the npx cache with this command.
> npx clear-npx-cache
When I tried to install the React app again it got installed perfectly.
So, what actually happens when we run this command?
This command helps to clear the cache and lets you install the package from the npm again and have a fresh start.
Actually, npm stores all the data in an opaque directory within the configured cache, named '_cacache'. This directory is a cacache -based content-addressable chache that stores all http requests data as well as package-related data.
Comments