Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall Node.JS using Linux command line?

People also ask

How do I completely uninstall node JS and reinstall from beginning Linux?

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.


In Ubuntu 12.04 simply type this

$ sudo apt-get remove nodejs

It will uninstall nodejs and npm as well simple.


Edit: If you know which package manager was used to install, it is best to uninstall with the same package manager. Examples for apt, make, yum are in other answers.

This is a manual approach:

Running which node will return something like /path/bin/node.

Then run cd /path

This is all that is added by Node.JS.

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

Now the only thing I don't know about is npm and what it has installed. If you install npm again into a custom path that starts off empty, then you can see what it adds and then you will be able to make a list for npm similar to the above list I made for node.


If you installed from source, you can issue the following command:

sudo make uninstall

If you followed the instructions on https://github.com/nodejs/node/wiki to install to your $HOME/local/node, then you have to type the following before the line above:

./configure --prefix=$HOME/local/node

Sorry the answer of George Bailey does work very fine when you want absolutely remove the node from your machine.

This answer is referred from : @tedeh https://github.com/nodesource/distributions/issues/486

If you wanna install a new version of node you have to use the code below

sudo rm -rf /var/cache/yum
sudo yum remove -y nodejs
sudo rm /etc/yum.repos.d/nodesource*
sudo yum clean all

And add new nodejs version to "yum" an new version of node

#using this command for Node version 8
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

#using this command for Node version 10
curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -

Install nodejs

sudo yum -y install nodejs

I hope it gonna help you guy!!!


To uninstall node I followed the accepted answer by @George, as I no longer have the sources, but before doing so I ran:

sudo npm rm npm -g

That seemed to get rid of npm from the system directories such as /usr/bin/npm and /usr/lib/npm. I got the command from here. I then found a ~/.npm directory, which I deleted manually. Honestly I don't know if every trace of npm has been removed, but I can't find anything else.