Ubuntu

How Can I Completely Uninstall Nodejs, NPM and Node in Ubuntu

Nodejs is an open-source cross platform environment based on JavaScript that makes it easy for the users to create diverse applications and software on the system. NPM stands for Node Package Manager that helps users install Nodejs packages. It also enables users to install any Node.js version on their system and switch to it in seconds. Though both Nodejs and NPM are beneficial in creating diverse applications, with the inclusion of more advanced alternatives, like ExpressJS, ASP.Net, Pyramid and more, it may not be the preferable choice for most users now.

If you have recently installed Nodejs, NPM and Node on Ubuntu, you can uninstall it any time using this article’s guidelines.

Uninstall Nodejs, NPM and Node in Ubuntu

Most Ubuntu users prefer to install Nodejs, NPM and Node from the official Ubuntu repository. So, here we will show you the easiest ways to successfully uninstall Nodejs, NPM and Node from the system, which are as follows:

Method 1: Uninstall from Ubuntu Repository

The Ubuntu users can successfully uninstall Nodejs, NPM and Node associated packages from Ubuntu system through the following command:

$ sudo apt purge --autoremove nodejs npm

 

Press “Y” at the command terminal to allow apt package manager to completely remove Nodejs, NPM and Node in Ubuntu.

Method 2: Uninstall from Source Directory

The Ubuntu users will find the Nodejs and NPM source directories inside the location “/usr/bin” and it can be confirmed through the following commands:

For Nodejs

$ which node

 

For NPM

$ which npm

 

The users have to remove these directories from the Ubuntu system through the following command to ensure complete uninstallation of Nodejs, NPM and Node.

$ sudo rm -rf /usr/bin/node /usr/bin/npm

 

The users can confirm the uninstallation of Nodejs, NPM and Node from Ubuntu system by executing the following commands:

For Nodejs

$ node -v

 

For NPM

$ npm -v

 

Conclusion

The complete uninstallation of Nodejs, NPM and Node is simple and it can be done by removing the packages from Ubuntu system through the “apt purge –autoremove” command, or removing the source directories of Nodejs and NPM from the system using the “rm -rf” command. Once the users successfully perform any method, they can then confirm uninstallation through the “-v” command.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.