Completely removing Node.js and Npm

Apparently i needed to completely remove my node.js and npm installation in my mac mavericks because i have installed various version of node.js from brew and nodejs.org website. After removing node from Brew, i am still able to access my node on my terminal and decides to write this to help anyone who is looking into removing and reinstalling node altogether (either from source or brew)

Removing Node.js

Credit goes to Dominic Tancredi
To recap, the best way (I've found) to completely uninstall node + npm is to do the following:

  • go to /usr/local/lib and delete any node and node_modules
  • go to /usr/local/include and delete any node and node_modules directory
  • if you installed with brew install node, then run brew uninstall node in your terminal
  • check your Home directory for any "local" or "lib" or "include" folders, and delete any "node" or "node_modules" from there
  • go to /usr/local/bin and delete any node executable

You may need to do the additional instructions as well:

  • remove: /usr/local/bin/npm
  • remove: /usr/local/share/man/man1/node.1
  • remove: /usr/local/lib/dtrace/node.d
  • execute: rm -rf /Users/[homedir]/.npm

Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as wel

Node still isn't uninstalled!

If you have done the above and you can still execute node on your terminate by firing

node

then you might need to do the following. Download the source code from nodejs.org exactly like how you have installed your nodejs from source


git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install

Inside the source code, instead of hitting 'make' and 'make install', do the following

sudo make uninstall

This instruction will uninstall whatever the source has installed into your machine.

Node and Npm still not uninstalled

Well, if you did all the above and you can still use node on your machine. You might want to try using 'locate' and manually removing all the necessary npm and node files in your machine by using

locate node 
locate npm

after you remove anything from the above command, you should fire the following to update the latest locate database

sudo /usr/libexec/locate.updatedb

but you will have the fire the above command every time you successfully remove certain directory as 'locate' only update periodically at a specific time every day.

3 thoughts on “Completely removing Node.js and Npm

  1. It's in reality a great and useful piece of info.
    I'm satisfied that you simply shared this useful information with us.
    Please keep us up to date like this. Thank you for sharing.

  2. Excellent post! I´d been struggling with this until I found your complete post! Thanks

Comments are closed.