Node.js and NPM help create different web-based applications; however, not all developers prefer them as an ideal choice for developing web applications. For this purpose, if a user has already installed Node.js and NPM on the Raspberry Pi system, they can follow this article’s guidelines that help them remove both Node.js and NPM from the system.
Completely Uninstall Nodejs and NPM in Raspberry Pi
There are multiple ways to install both Node.js and NPM on the Raspberry Pi system, thus, the methods to remove them are different. These methods include:
Method 1: Uninstall Node.js and NPM from Raspberry Pi Repository
Installing Node.js and NPM directly through the Raspberry Pi repository is the most straightforward method. If you are the one who installed Node.js and NPM from the Raspberry Pi repository, you can uninstall or completely remove them from the system by simply executing the following command:
Method 2: Uninstall Node.js and NPM By Deleting Source Files from the System
You can also completely uninstall Node.js and NPM from the Raspberry Pi system by removing their source directory. For this purpose, first you have to find the location where Node.js and NPM is installed and you can find it using the following commands:
$ which npm
After finding the location of Node.js and NPM on the Raspberry Pi system, you can simply remove these directories using the following command:
You can confirm remove of Node.js and NPM through following commands:
$ npm -v
The above commands ensure that both Node.js and NPM are successfully removed from the system.
Conclusion
The guidelines above show you two different ways to completely remove Node.js and NPM from the Raspberry Pi system. These methods include removing them through the “apt purge –autoremove” command or removing the source directories of both Node.js and NPM through the “rm -rf” command.