Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall nodejs installed from binary distribution files

Tags:

node.js

ubuntu

I have installed nodejs(node-v4.2.1) in ubuntu 14.04 using zip file(tar.gz) downloaded from node js website(not using apt-get install.The location of installed node is /usr/local/bin.

while trying to uninstall it using sudo apt-get purge,sudo apt-get remove &sudo apt-get autoremove is not working.How could I uninstall it?

like image 771
Vineeth Bhaskaran Avatar asked Oct 25 '25 20:10

Vineeth Bhaskaran


1 Answers

I got the solution from the links given below

http://hungred.com/how-to/completely-removing-nodejs-npm/

How to install node binary distribution files on Linux

I did the following steps and it works fine


sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/lib/node_modules/
sudo rm -rf /usr/local/include/node/
sudo rm -rf /usr/local/share/man/man1/node.1



cd /home/userName
ls -ld .?* (to display hidden files)
# delete files/folders related with node
sudo rm -f .node_repl_history
sudo rm -rf .npm

To Re-install new version follow the below steps

1.Download new version from Node official website.In my case my downloaded file is node-v6.9.4-linux-x64.tar.xz

2.Move the file into /usr/local directory using the command

sudo mv  Downloads/node-v6.9.4-linux-x64.tar.xz /usr/local

3.Use the below command to extract into appropriate directories in /usr/local

sudo tar --strip-components 1 -xf node-v6.9.4-linux-x64.tar.xz

-xf is to unzip .tar.xz for tar.gz use -xzf

4.verify installation

node --version
like image 111
Vineeth Bhaskaran Avatar answered Oct 28 '25 09:10

Vineeth Bhaskaran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!