How to Uninstall Node.js from Your System

February, 3rd 2025 2 min read

Removing Node.js fully from a system often requires more than running an uninstaller. Depending on whether Node.js was installed using packages, Homebrew, system package managers, or version managers like NVM, remnants can remain in environment variables, hidden directories, or global module folders. This guide provides a clean, complete, and platform‑specific approach for Windows, macOS, and Linux.

Windows

1. Uninstall Node.js via Control Panel

  1. Press Win + R, type appwiz.cpl, and press Enter.
  2. Find Node.js in the program list.
  3. Right‑click → Uninstall.
  4. Follow the uninstall wizard.

2. Remove Remaining Files and Directories

Delete Node‑related folders:

plaintext
C:\Program Files\nodejs
C:\Users\<YourUser>\AppData\Roaming\npm
C:\Users\<YourUser>\AppData\Roaming\npm-cache
C:\Users\<YourUser>\.npmrc

3. Clean Environment Variables

  1. Press Win + R, type sysdm.cpl.
  2. Open AdvancedEnvironment Variables.
  3. Under “System variables → Path”, delete Node.js and npm paths.
  4. Confirm changes.

4. Verify Removal

plaintext
node -v
npm -v

You should see a command not found message.


macOS

1. Uninstall via Homebrew (If installed with Brew)

plaintext
brew uninstall node

2. Remove Node Files Manually

plaintext
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 ~/.npm ~/.nvm ~/.node

3. Clean Shell Configuration

Edit your shell rc file:

plaintext
nano ~/.zshrc

Remove Node‑related exports or PATH entries, then reload:

plaintext
source ~/.zshrc

4. Verify Removal

plaintext
node -v
npm -v

Linux (Ubuntu / Debian)

1. Uninstall Node.js

If installed via APT:

plaintext
sudo apt-get remove --purge nodejs
sudo apt-get autoremove

If installed via NVM:

plaintext
nvm deactivate
nvm uninstall node

2. Clean Node.js Directories

plaintext
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/bin/node
rm -rf ~/.npm ~/.nvm ~/.node

3. Remove PATH Entries

Edit:

plaintext
nano ~/.bashrc

Remove Node or npm exports.

4. Verify Removal

plaintext
node -v
npm -v

If both return command not found, Node.js was fully removed.


Conclusion

Fully uninstalling Node.js requires removing global binaries, cached directories, and PATH entries. Whether you’re switching versions, resetting your environment, or resolving conflicts, following platform‑specific cleanup steps ensures Node.js is removed completely and cleanly.