Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install -g not working while uninstalling react-native-cli?

I am trying to uninstall the "react-native-cli" which I use for react-native projects! but I am not able to do so! My environment is mac.

Here is what i have done so far!

Whether I type npm uninstall -g react-native-cli or sudo npm uninstall -g react-native-cli.

The terminal shows: up to date in 0.041s

enter image description here

When I type react-native init projectName, it still creates the project.

I think the command react-native init should not to work.

Anyone knows how to uninstall react-native-cli ?

Thanks in advance.

like image 223
Morton Avatar asked Dec 04 '22 19:12

Morton


2 Answers

SOLUTION ONE ! not fully sure this will work! but try updating your npm first by doing

npm install npm

and after that try uninstalling the cli if that does not work then

SOLUTION TWO !

Here is another go around to solve the issue its a bit manual way

1: First run this

npm list -g

this will show the list of installed packages in your user folder

then check . using command+f if there is react-native-cil there

then do this

open /usr/local/lib/node_modules

This will open the root installed packages and you can manually find and delete the react-native-cli like this

enter image description here

like image 188
M.Rizwan Avatar answered Dec 06 '22 11:12

M.Rizwan


If you are using yarn. You can do yarn global list then check that if any package contains react-native. Then run yarn global remove <package> to remove that package.

ex:

yarn global remove @react-native-community/cli
like image 35
Tuan Luong Avatar answered Dec 06 '22 10:12

Tuan Luong