Tuesday, October 22, 2019

How to completely remove NodeJs and NPM in Ubuntu

Hi,

In this post I am going to write about how to completely remove NodeJs and NPM from ubuntu.... I was having Ubuntu-16.04 as my operating system during installation of NodeJs and NPM, this procedure should be fine for future versions and to some extent recent past versions of ubuntu

With that said, lets get into action

Assuming you have installed NodeJs and NPM using apt-get, the following is the procedure to completely remove NodeJs and NPM from your presonal computer....

Open up a terminal, and fire the command below...
> sudo apt-get update
The above command will make the local repository in sync with the remote repository for the other commands to have a smooth process.

Once the update is done, fire the following commands one by one at the terminal

Removing NodeJs

> sudo apt-get purge --auto-remove nodejs
> sudo apt-get purge nodejs
> sudo apt-get autoremove

The above commands ensures the removal of NodeJs but it will not ensure the removal of files installed during installation, after the removal of NodeJs there would be some files left orphan in the system, to remove those file(s) proceed with the following commands...

> sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules

To remove node or node_modules from /usr/local/lib
> sudo rm -rf /usr/local/lib/node*

To remove node or node_modules directories from /usr/local/include
> sudo rm -rf /usr/local/include/node*

To remove any node file or dir from /usr/local/bin
> sudo rm -rf /usr/local/bin/node*

Removing Node Package Manager
To remove NPM, fire the following commands at the prompt...

> sudo apt-get purge --auto-remove npm
> sudo apt-get purge npm
> sudo apt-get autoremove

Well with this I conclude this post, if you find any discrepancies please comment it in the comment section below....

As always, hope you had good time reading...

Ciao.

No comments:

Post a Comment

How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...