If you’ve ever used create-react-app as a global installation or through npx, but was previously on version 4.x.x of create-react-app/react-scripts, then you may notice an error when you run the command below, as it tries to use the latest version (5.x.x as of this writing).
npx create-react-app myapp
You are running create-react-app 4.x.x, which is behind the latest release (5.0.1). We no longer support global installation of Create React App.
The current solution is simple — run create-react-app and target the latest version.
npx create-react-app@latest myapp
Different versions of npm may help as well, and you can upgrade using the following command. Please note that this may affect other projects on your system.
npm install -g npm@latest
3 Replies to “npx create-react-app not working? Here’s the solution.”
I was trying everything: npm uninstall -g create-react-app; npm update npx. And nothing worked, until I found your article. But now I have a question: will I have to use npx create-react-app@latest for all future projects since, apparently, npm no longer supports global installation of create-react-app?
You’re welcome! You can try something like npx clear-npx-cache
It seems something is left behind even when uninstalling the global install of create-react-app. Otherwise, aside from a _clean_ install and removing all cache, I’ve still just been using npx create-react-app@latest on some of my older environments anyway.
Thanks a lot, its working now.