Issues with uninstalling create-react-app

I am running npm uninstall create-react-app, and it returns

npm WARN saveError ENOENT: no such file or directory, open '/Users/me/Documents/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/me/Documents/package.json'
npm WARN Documents No description
npm WARN Documents No repository field.
npm WARN Documents No README data
npm WARN Documents No license field.

I want to update my create-react-app version, and apparently they no longer support global installs. When I installed CRA the first time (a while ago), it was installed globally. Now, I am trying to update it, and I'm running into issues. I ran npm update create-react-app, however my terminal just blinks for a second and returns to the prompt. I, therefore, decided to uninstall create-react-app altogether and reinstall it, however now I'm running into the above warnings/issues.

Any thoughts on what may be going on?

Edit:

When I run npm i create-react-app, it also throws the above WARNs, but it also says

+ [email protected] // <---
added 1 package and audited 578 packages in 1.787s

However, when I run the command create-react-app --version again, it says 3.2.0

Edit 2:

I've ran npm i -g create-react-app several times, but that throws:

Michaels-MacBook-Pro:Documents me$ npm i -g create-react-app
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/create-react-app/index.js
npm ERR! dest /usr/local/bin/create-react-app
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/create-react-app/index.js' -> '/usr/local/bin/create-react-app'
npm ERR! File exists: /usr/local/bin/create-react-app
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2019-12-23T08_07_29_158Z-debug.log


Solution 1:

After globally uninstalling create-react-app, I was still getting an error that my create-react-app was out of date. Here's what solved that for me:

After

sudo npm uninstall -g create-react-app

Run

npx clear-npx-cache

Then try reinstalling create-react-app in the proper working directory:

npx create-react-app my-app

Solution 2:

To uninstall it completely try running

sudo npm uninstall -g create-react-app

some times this command may not remove the package completely. if so just check the directory where its located by

which create-react-app

and it will give you some directory like /usr/local/bin/create-react-app. just remove it manually by

rm -rf /usr/local/bin/create-react-app

now you can install create-react-app by

npm install -g create-react-app

but however, it is not recommended to install it globally from v3.3.0.so just use

npx create-react-app <project_name>

Solution 3:

Just install over it by rerunning this command. sudo npm i -g create-react-app

I personally use NCU (https://www.npmjs.com/package/npm-check-updates) to update all my node stuff. It works globally and per project.

Solution 4:

Going further with Windows 10

While Dhruv answer solved this problem for me (finding and deleting create-react-app and then reinstall), I still had a few problems finding create-react-app in my windows 10 system.

I was trying to find my global install, (where create-react-app produced no results for me) and as far as I could tell it was never installed. but using an elevated cmd prompt by using Win + X keys, selecting "Windows PowerShell (Admin)" and then navigating to my desired working directory I could then execute npx create-react-app my-test-app and it created a working react directory.

It seems in Windows 10, elevated cmd prompt is the way forward for using npx create-react-app my-test-app successfully. I am not sure why this is though. As previously it was working (at least for me) with the normal cmd prompt

Solution 5:

For windows

tried npm uninstall -g create-react-app that didn't work for me.

I did the following and it worked:

  1. Elevated cmd prompt: where create-react-app it was somewhere in the system files under yarn. follow that path and delete both the files.
  2. Go to the working directory, in my case a folder inside documents. run npx create-react-app my-test-app

This will create a new folder called my-test-app and you can follow the rest of the instructions on the react app website.

cd into that new folder, run yarn start