Table of contents
1.
Introduction
2.
Prerequisites
3.
Uninstalling Node.js in Windows
3.1.
Step 1: Uninstall Node.js via Control Panel
3.2.
Step 2: Remove Node.js Folders
3.3.
Step 3: Remove Environment Variables
4.
Uninstalling Node.js in Ubuntu
4.1.
Method 1: Uninstall Node.js using apt (For apt-based Installation)
4.2.
Method 2: Remove Node.js Installed via nvm
4.3.
Method 3: Remove Node.js Installed via Snap
5.
Uninstalling Node.js on Mac
5.1.
Method 1: Uninstalling Node.js Installed via Homebrew
5.2.
Method 2: Uninstalling Node.js Installed via Installer
6.
Frequently Asked Questions
6.1.
Why would I need to uninstall Node.js?
6.2.
Can I reinstall Node.js after uninstalling it?
6.3.
Will uninstalling Node.js remove npm as well?
7.
Conclusion
Last Updated: Feb 3, 2025
Easy

How to uninstall Node.js?

Author Gaurav Gandhi
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

How to uninstall Node.js is an important topic for developers who need to remove Node.js from their systems. Whether you are troubleshooting issues, upgrading to a new version, or simply no longer need Node.js, knowing the correct steps to uninstall it is essential. The uninstallation process can vary depending on your operating system, such as Windows, macOS, or Linux, but it is relatively straightforward once you know the steps. 

How to uninstall Node.js?

In this article, you will learn the methods for uninstalling Node.js on different platforms, how to remove any residual files, and ensure that Node.js is completely removed from your system.

Prerequisites

Before uninstalling Node.js, ensure that:

  • You have administrative or root access to your system.
     
  • You have backed up any important projects or files that might be using Node.js.
     
  • You have checked if any applications rely on Node.js before uninstalling it.

Uninstalling Node.js in Windows

To remove Node.js from Windows, follow these steps:

Step 1: Uninstall Node.js via Control Panel

  1. Open the Control Panel.
     
  2. Navigate to Programs > Programs and Features.
     
  3. Scroll down and locate Node.js.
     
  4. Click on it and select Uninstall.
     
  5. Follow the on-screen instructions to complete the uninstallation process.

Step 2: Remove Node.js Folders

Even after uninstalling Node.js, some residual files may remain. Remove them manually:

  1. Open File Explorer and navigate to the following directories:
    • C:\\Program Files\\nodejs
       
    • C:\\Users\\<YourUsername>\\AppData\\Roaming\\npm
       
    • C:\\Users\\<YourUsername>\\AppData\\Roaming\\nvm
       
  2. Delete these folders to remove all traces of Node.js.

Step 3: Remove Environment Variables

  1. Open the Start Menu, search for Environment Variables, and open it.
     
  2. In the System Properties window, click on Environment Variables.
     
  3. Under System variables, find Path and click Edit.
     
  4. Remove any paths related to Node.js and npm (e.g., C:\\Program Files\\nodejs\\ and C:\\Users\\<YourUsername>\\AppData\\Roaming\\npm).
     
  5. Click OK to save changes.

Uninstalling Node.js in Ubuntu

If you have installed Node.js using apt, nvm, or snap, follow these methods to uninstall it:

Method 1: Uninstall Node.js using apt (For apt-based Installation)

Run the following command to remove Node.js:

sudo apt remove nodejs -y


To remove additional related files:

sudo apt autoremove -y
sudo apt purge nodejs -y

Method 2: Remove Node.js Installed via nvm

If you installed Node.js using Node Version Manager (nvm), use the following commands:

nvm deactivate
nvm uninstall <version>

 

To remove nvm completely:

rm -rf ~/.nvm

 

Also, remove related lines in the ~/.bashrc, ~/.bash_profile, or ~/.zshrc file.

Method 3: Remove Node.js Installed via Snap

If you installed Node.js via snap, remove it using:

sudo snap remove node

Uninstalling Node.js on Mac

To remove Node.js from macOS, use one of these methods depending on how it was installed:

Method 1: Uninstalling Node.js Installed via Homebrew

Run the following command in Terminal:

brew uninstall node

To remove leftover files:

rm -rf ~/.npm
rm -rf ~/.node-gyp

Method 2: Uninstalling Node.js Installed via Installer

Open Terminal and run:

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/share/man/man1/node*


Verify removal:

node -v


If the output is  “command not found”, Node.js has been successfully uninstalled.

Frequently Asked Questions

Why would I need to uninstall Node.js?

There are several reasons you might need to uninstall Node.js, such as switching to a different version, resolving conflicts with other software, or freeing up system resources if you no longer need it.

Can I reinstall Node.js after uninstalling it?

Yes, you can reinstall Node.js anytime by downloading it from the official website or using package managers like apt, brew, or nvm.

Will uninstalling Node.js remove npm as well?

Yes, npm (Node Package Manager) is bundled with Node.js, so uninstalling Node.js will remove npm too.

Conclusion

In this article, we covered different methods to uninstall Node.js from Windows, Ubuntu, and macOS. We also learned how to remove residual files and clean up the system completely. Whether you are switching to a different version of Node.js or no longer need it, these steps will help ensure a proper uninstallation process.

Live masterclass