I have the exact same problem as this question. I have tried the following possible solutions
npx clear-npx-cache
output
Need to install the following packages:
clear-npx-cache
Ok to proceed? (y) y
npm uninstall -g create-react-app
output
removed 67 packages, and audited 1 package in 380ms
found 0 vulnerabilities
npm install -g create-react-app@5.0.0
and it got installed successfully. After this when I tried npx create-react-app frontend
it gave the same error that I was using 4.0.3 version of 'create-react-app'
this means that the npx cache is not cleared as it was supposed to. It is worth mentioning that I am using nvm to manage my node version and am on Ubuntu 21.1 for this reason I checked out where my react scripts were
npm ls -g create-react-app
output
/home/vaibhav/.nvm/versions/node/v16.14.0/lib
`-- (empty)
also I suppose the above command to clear npx cache actually deletes the _npx
folder? I may be wrong here but the _npx
folder is actually located in here
/home/vaibhav/.npm/npx
I just want to install the latest version of create-react-app scripts in the global directory hope the above information would be enough.