Node.js is a powerful tool for building server-side applications, but sometimes you may need to uninstall it from your Ubuntu system.
Whether you’re moving to a different version or simply want to clean up your system, this tutorial will guide you through the steps to uninstall Node.js on Ubuntu.
Steps:
1. Open the terminal window on your Ubuntu system.
2. Enter the following command to remove any Node.js package installed on your system:
1 |
sudo apt-get remove --purge nodejs |
3. Remove all npm packages installed on your system using the following command:
1 |
sudo apt-get remove --purge npm |
4. If you used NodeSource to install Node.js, run the following command to remove it:
1 |
sudo apt-get remove --purge nodejs-* |
5. Remove all node_modules directories using the following command:
1 |
sudo find / -name "node_modules" -type d -exec rm -rf {} + |
6. Finally, remove the Node.js PPA repository using the following command:
1 |
sudo add-apt-repository --remove ppa:chris-lea/node.js |
Conclusion:
By following these simple steps, you can easily uninstall Node.js from your Ubuntu system. Remember to double-check that all packages and directories related to Node.js have been removed before continuing with other tasks.
If you ever need to reinstall Node.js on your Ubuntu system, simply follow the official documentation provided by Node.js or use one of the many online tutorials available on the web.