facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.71k stars 26.85k forks source link

Not working after update #10495

Open dan-ville opened 3 years ago

dan-ville commented 3 years ago

Hi, I get this error whenever I run the command $ npx create-react-app new-app in my terminal, and I follow the instructions to uninstall via npm uninstall -g create-react-app and then try to make a new react app but it simply keeps giving me the same error.

Is this happening for anyone else??

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

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
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

npm ERR! code 1
npm ERR! path /home/dvill/programming/my apps/feeding-miami
npm ERR! command failed
npm ERR! command sh -c create-react-app "new-app"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dvill/.npm/_logs/2021-02-03T19_35_15_972Z-debug.log
klleroy commented 3 years ago

I've been encountering this as well today! Works on 14.15.4 but not 15.8.

TaylorDarneille commented 3 years ago

While not super sensible, these are the two different fixes we quickly discovered in the middle of teaching a react lesson in an SE bootcamp today (if npm uninstall -g create-react-app doesn't work):

  1. Literally do the opposite of what the error message says: run npm -g create-react-app and then you can rn npx create-react-app sitename
  2. In a slightly less confusing fix, this also seems to work: npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f
klleroy commented 3 years ago

Super helpful. Thanks @TaylorDarneille!

dan-ville commented 3 years ago

@TaylorDarneille Amazing, thanks!

trisha commented 3 years ago

While not super sensible, these are the two different fixes we quickly discovered in the middle of teaching a react lesson in an SE bootcamp today (if npm uninstall -g create-react-app doesn't work):

  1. Literally do the opposite of what the error message says: run npm -g create-react-app and then you can rn npx create-react-app sitename
  2. In a slightly less confusing fix, this also seems to work: npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f

Confirming that option 1 oddly worked for me, too!

peterbe commented 3 years ago

I still don't want to install create-react-app with yarn or with npm. I encounter the same error with the wonderful npx.

Steps to reproduce

cd /tmp
npx create-react-app cra

(same error as mentioned above)

Coteh commented 3 years ago

Just had this happen to me again with 4.0.3 update, and this time cleaning npm cache did not fix it. I needed to run npm install -g create-react-app as noted by @TaylorDarneille to fix it this time.

geoffreyshepard commented 3 years ago

I was having this problem and solved it by deleting my root user's node_modules. This allowed me to do a fresh install with create-react-app, might be worth a try