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
/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript:/usr/lib/node_modules/lineman/:/usr/lib/node_modules/lineman/src/:/usr/lib/node_modules/src/:/usr/lib/node_modules/tasks/:/var/www/docular/node_modules/:/var/www/docular/node_modules/src/:/var/www/node_modules/:
root@lineman:/usr/local# NODE_PATH=
root@lineman:/usr/local# echo $NODE_PATH
root@lineman:/usr/local#

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