How to completely Uninstall node.js on Ubuntu

For some reason or another you want to uninstall node.js. This can depend on how you installed node.js in the first place but here are a couple of methods which you can use to uninstall node.js complete from Ubuntu Linux.

Uninstall node.js on Ubuntu – Method 1

Check where your node is installed.

which node

Change to this folder (in the example your local directory) and remove node files.

cd /usr/local
rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1

Also removed this folder if it exists.

rm -rf ~/local/node-latest-install/

Uninstall node.js on Ubuntu – Method 2

You can also run this if your using Ubuntu 12+.

sudo apt-get remove nodejs

Uninstall node.js

Bonus steps

Also clear your node path (or unset).

root@lineman:/usr/local# echo $NODE_PATH
root@lineman:/usr/local# NODE_PATH=
root@lineman:/usr/local# echo $NODE_PATH

I also removed any references to PATH in my ~/.bashrc