1

I have tried the standard

brew uninstall node

and even went to /usr/local/ to delete the files according to this post: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

I have received a bunch of error messages but when I type

node -v

I still get v8.9.4. I can't seem to uninstall it. I'm trying to get to version v6.10.0. Now when I type brew uninstall node it gives the error

Error: No such keg: /usr/local/Cellar/node

What more do I need to do?

Alexander Keefe
  • 23
  • 1
  • 2
  • 3

2 Answers2

4

I recommend figuring out where your node is. To do this type:

 which node

If you installed it via homebrew:

 brew uninstall node

If installed via nvm

You can uninstall a specific version

 nvm ls
 nvm uninstall 10.4.1

or get rid of nvm and node entirely

 rm -rf ~/.nvm

and remove all references to NVM in your bash profile.

John Franke
  • 1,444
  • 19
  • 23
  • Okay, I did that and did brew install node@6 it says node is installed when I check with brew but when I try to run node or try node -v I have the error of -bash: /Users/alexanderkeefe/.nvm/versions/node/v8.9.4/bin/node: No such file or directory – Alexander Keefe Oct 15 '18 at 19:39
  • Try reinstalling nvm `brew install nvm`, you can use it to manage specific versions of node `nvm install 6.0.0`. You may want to source your profile again as well (close and open your terminal window). – John Franke Oct 15 '18 at 19:44
  • 1
    oh, I think that helped. I also ended up going to this page https://nodejs.org/en/blog/release/v6.10.0/ to get the installer wizard instead of doing it from the command line. Thanks so much! – Alexander Keefe Oct 15 '18 at 19:51
  • 1
    No problem, I definitely recommend NVM to manage your different node versions. Cheers! – John Franke Oct 15 '18 at 19:53
  • 1
    Mine is in `/usr/local/bin/node` – Jonny Dec 26 '18 at 06:23
  • @Jonny Did you install node via homebrew? If so, you can brew uninstall node. Then I recommend using the nvm package to manage your node versions. – John Franke Dec 26 '18 at 15:59
  • Don't really remember how/when I installed node Manually removing files and installing using brew now and I always get this: "Warning: The post-install step did not complete successfully". So, I'll try to install using NVM for now. – Jonny Dec 27 '18 at 01:01
  • Nvm is definitely the way to go. Cheers! – John Franke Dec 27 '18 at 01:19
1

You can check out the Node installation in mac by using the below command. It will show node js version installed in your device.

node -v

Open the terminal and enter the given below command to know your current directory.

pwd

Go to your root directory.

cd /

Then enter into the usr directory by using following command.

cd usr

Go to locale directory.

cd local

Enter into include folder by using given below command.

cd include

Now if you enter the ls command then you’ll see the node folder inside the include folder like given below.

ls

node

We have to remove this node folder to completely uninstall the Node js from MacOS.

sudo rm -R node

Remove node_modules from MacOS

In next step we have to completely remove node_modules from our system.

Follow the steps

Enter the below command to go back to previous folder.

cd ..

Go to lib directory, hit the below command to enter into the lib directory.

cd lib

Use the below command to remove the node_modules (NPM) folder.

sudo rm -R node_modules

Enter the below command to come out from the directory.

cd ..

Go to bin folder using below command.

cd bin

Here you also have to delete the node folder to uninstall the Node js completely.

Enter the below command to remove the Node js from MacOS.

sudo rm -R node

Finally, we’ve successfully uninstalled the Node JS from MacOS, use the given below command to check whether the Node and NPM completely removed from our system.

node -v

We have completed our task if you are getting below output.

-bash: node: command not found

hassan
  • 81
  • 4