1

I'm unable to use create-react-app

 $ npx create-react-app myapp

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

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

but I don't seem to have create-react-app already installed

$ npm uninstall -g create-react-app

up to date, audited 1 package in 348ms

found 0 vulnerabilities

But yet I still can't install it

npm install create-react-app

What can I do to get the right version of create-react-app installed?

A possible correlation is that I use node version manager because I need the older 11.15.0 version of node for our UI but I also have the latest version of node installed, and I have uninstalled create-react-app in both versions

$ nvm ls
       v11.15.0
->     v16.13.0
         system
default -> lts/* (-> v16.13.0)
node -> stable (-> v16.13.0) (default)
stable -> 16.13 (-> v16.13.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/gallium (-> v16.13.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.7 (-> N/A)
lts/fermium -> v14.18.1 (-> N/A)
lts/gallium -> v16.13.0
draca
  • 1,319
  • 5
  • 16
  • 32

2 Answers2

0

I've found success by manually asking for the latest version of create-react-app when running it with npx:

$ npx create-react-app@latest myapp
HPierce
  • 7,249
  • 7
  • 33
  • 49
  • It didn't work. Still got the same exact error message – draca Jan 12 '22 at 01:22
  • Makes sense - looks like [create-react-app@5.0 requires node 14](https://github.com/facebook/create-react-app/blob/221e511730ca51c036c6954a9d2ee7659ff860f9/packages/create-react-app/package.json#L15) while [4.0.3 is compatible with node 10](https://github.com/facebook/create-react-app/blob/f92c37a6e6636ed1650ffd976c6881f59b1be803/packages/create-react-app/package.json#L15). `npx` will probably use the latest version that's compatible with your node version. – HPierce Jan 12 '22 at 02:29
  • So how can I get create-app-working? I can install another node version if need be – draca Jan 12 '22 at 03:59
0

Try the following, from this answer:

$ npx clear-npx-cache
$ npx create-react-app myapp
ThatNerd
  • 31
  • 2
  • 2