3

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?

Vineeth Bhaskaran
  • 2,161
  • 1
  • 29
  • 36

2 Answers2

7

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
Community
  • 1
  • 1
Vineeth Bhaskaran
  • 2,161
  • 1
  • 29
  • 36
1

Check if there is an uninstall script in the zip, otherwise you need to clean /usr/local manually for any node related artefacts.

TeTeT
  • 2,044
  • 20
  • 30