Uninstalling Node.js is rarely the one-step "drag to trash" people expect, because the right command depends entirely on how Node was installed: a version manager (nvm, fnm, Volta, n), the official nodejs.org installer, your OS package manager (apt, dnf, brew, winget, choco), or a Docker image you just stop using. Each path removes the node binary differently, and almost none of them clean up the leftovers: the global npm package directory, the npm/npx caches, and the PATH lines in your shell rc file. I have torn Node off machines to fix a wedged install, to clear out a botched permission setup, and to hand a laptop back clean. The binary always goes easily; the orphaned ~/.npm cache and the dead PATH export that prints node: command not found on every new shell are what bite later. Below is the full removal reference for every realistic install route in 2026, including the leftover-files checklist that most guides skip.
How do I uninstall Node.js?
To uninstall Node.js, first find out how it was installed by running which node (or where node on Windows). If the path is under ~/.nvm, remove that version with nvm uninstall <version> (or delete ~/.nvm entirely to remove nvm and every Node it manages). For fnm, fnm uninstall <version>; for Volta, delete ~/.volta; for n, sudo n rm <version> then sudo npm rm -g n. If you installed from nodejs.org, on macOS remove /usr/local/bin/node, /usr/local/bin/npm, and the node files under /usr/local/lib and /usr/local/include; on Windows use "Apps and features" (or winget uninstall OpenJS.NodeJS). On Linux without a manager, sudo apt-get remove --purge nodejs (Debian/Ubuntu) or sudo dnf remove nodejs (RHEL/Fedora). On macOS Homebrew, brew uninstall node. After removing the binary, delete the leftovers: ~/.npm (cache), ~/.node-gyp, the global package dir (~/.npm-global or /usr/local/lib/node_modules), and any nvm/fnm/volta lines in ~/.bashrc or ~/.zshrc. Open a new terminal and confirm with which node returning nothing.
Jump to:
- Pre-flight: find out how Node was installed
- Method by install type (quick table)
- Uninstall a version manager (nvm, fnm, Volta, n)
- Uninstall the nodejs.org installer on macOS
- Uninstall on Windows
- Uninstall via OS package managers
- Remove a Docker Node image
- The leftover-files checklist (the part everyone skips)
- Verify Node is fully gone
- Troubleshooting
- FAQ
Pre-flight: find out how Node was installed
Before deleting anything, capture what you have. The single most useful command is which node, because the path tells you which removal route to take:
node --version # e.g. v22.11.0
which node # the install path is the whole answer
npm --version # confirm npm came along with itRead the path it prints:
which node prints | Install type | Removal route |
|---|---|---|
~/.nvm/versions/node/... | nvm | nvm uninstall or delete ~/.nvm |
~/.fnm/... or ~/Library/.../fnm/... | fnm | fnm uninstall or delete the fnm dir |
~/.volta/bin/node | Volta | delete ~/.volta |
/usr/local/bin/node (macOS, no brew) | nodejs.org installer or n | manual file removal |
/opt/homebrew/bin/node or /usr/local/... (brew) | Homebrew | brew uninstall node |
/usr/bin/node (Linux) | apt / dnf / NodeSource | apt remove / dnf remove |
C:\Program Files\nodejs\node.exe | Windows .msi / winget | Apps and features |
On Windows, run where node in PowerShell or cmd to get the same answer. If which node prints two paths, you have more than one install fighting over PATH; note both, because you will want to remove the dead one (see Troubleshooting).
If which node prints nothing, Node is already off your PATH and you may only have leftovers to clean up (jump to the leftover-files checklist).
Method by install type (quick table)
| Install type | Uninstall command | Removes leftovers? |
|---|---|---|
| nvm | nvm uninstall <version>, or rm -rf ~/.nvm for all of it | No, you remove the rc-file line by hand |
| fnm | fnm uninstall <version>, or delete the fnm dir | No, remove the fnm env rc line by hand |
| Volta | rm -rf ~/.volta | No, remove the VOLTA_HOME/PATH rc lines by hand |
| n | sudo n rm <version> then sudo npm rm -g n | Partly, /usr/local/n may linger |
| nodejs.org (macOS) | manual rm of the installed files (script below) | No |
| nodejs.org (Windows) | Apps and features, or winget uninstall | No, %AppData%\npm lingers |
| apt / dnf | sudo apt-get remove --purge nodejs / sudo dnf remove nodejs | --purge removes config, not ~/.npm |
| Homebrew | brew uninstall node | Mostly, ~/.npm cache lingers |
| winget / choco | winget uninstall OpenJS.NodeJS / choco uninstall nodejs | No |
| Docker | docker rmi node:<tag> | N/A, image is self-contained |
The recurring theme: removing the binary is one command, but no package manager or version manager cleans up the per-user npm state. That is the leftover-files checklist below.
Uninstall a version manager (nvm, fnm, Volta, n)
If a version manager owns your Node, let it do the removal. You can either uninstall a single Node version (keeping the manager) or remove the manager entirely.
nvm. Remove one version, or wipe the whole thing:
nvm ls # list installed versions
nvm uninstall 18.19.0 # remove one version
nvm uninstall --lts # remove the current LTS install
# Remove nvm itself and every Node it manages:
rm -rf "$NVM_DIR" # usually ~/.nvm
rm -rf ~/.nvm # if $NVM_DIR is unsetThen delete the nvm block from your shell rc file (~/.bashrc, ~/.zshrc, or ~/.profile). nvm's installer appends something like:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"Remove those lines, save, and open a new terminal. nvm does not have a self-uninstall command; deleting the directory plus the rc lines is the documented way.
fnm. Same pattern:
fnm list # installed versions
fnm uninstall 18.19.0 # remove one version
# Remove fnm itself: delete its binary and data dir, then the rc hook
rm -rf ~/.local/share/fnm ~/.fnmIf you installed fnm via Homebrew use brew uninstall fnm; via winget, winget uninstall Schniz.fnm. Remove the eval "$(fnm env --use-on-cd)" line from your rc file (or the PowerShell $PROFILE equivalent).
Volta. Volta has no uninstall subcommand; you delete its directory:
rm -rf ~/.voltaThen remove the two lines Volta's installer added to your rc file:
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"Because Volta also shims npm/yarn/pnpm, deleting ~/.volta takes those shims with it. Any Node version pinned in a project's package.json "volta" key is just metadata; it does nothing once Volta is gone.
n. n installs into /usr/local and is itself an npm global:
sudo n rm 18.19.0 # remove a managed version
sudo npm rm -g n # remove the n tool
# n leaves the version cache behind; clear it:
sudo rm -rf /usr/local/nBecause n symlinks the active Node into /usr/local/bin/node, also check that /usr/local/bin/node, npm, and npx are gone after the above. If they still point at a deleted target, sudo rm them.
Uninstall the nodejs.org installer on macOS
The macOS .pkg from nodejs.org does not ship an uninstaller. It drops files into /usr/local, and you remove them by hand. This is the canonical command set (it is what the old pkgutil receipts list):
sudo rm -rf /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/npx
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/share/man/man1/node.1
sudo rm -rf /usr/local/share/doc/node
# Forget the installer receipts so macOS no longer thinks Node is present:
sudo pkgutil --forget org.nodejs.node.pkg 2>/dev/null
sudo pkgutil --forget org.nodejs.pkg 2>/dev/nullpkgutil --pkgs | grep -i node lists the exact receipt IDs on your machine if those two do not match; forget whatever it prints. After this, the per-user leftovers (~/.npm, ~/.node-gyp) are still there; see the leftover-files checklist.
If node lives under /opt/homebrew (Apple Silicon Homebrew) rather than /usr/local, it is a brew install, not the .pkg. Use brew uninstall node instead of the manual removal above.
Uninstall on Windows
The nodejs.org .msi and the winget package both register a proper uninstaller, so use it; do not hand-delete C:\Program Files\nodejs.
GUI route: Settings, then "Apps", then "Installed apps", find Node.js, then "Uninstall".
Command line:
# winget (works whether you installed via winget or the .msi)
winget uninstall OpenJS.NodeJS
winget uninstall OpenJS.NodeJS.LTS
# Chocolatey
choco uninstall nodejs
choco uninstall nodejs-ltsThe Windows uninstaller removes C:\Program Files\nodejs and its PATH entry, but it leaves the per-user npm state behind. After uninstalling, delete these by hand (close all terminals first):
Remove-Item -Recurse -Force "$env:AppData\npm"
Remove-Item -Recurse -Force "$env:AppData\npm-cache"
Remove-Item -Recurse -Force "$env:LocalAppData\npm-cache"
Remove-Item -Recurse -Force "$env:UserProfile\.node-gyp"Then check the user and system PATH in "Edit environment variables" and remove any stale ...\nodejs or ...\AppData\Roaming\npm entries the uninstaller missed. For nvm-windows, use its own uninstaller from Apps and features rather than deleting the install directory, because it manages a symlink that the uninstaller cleans up properly.
Uninstall via OS package managers
If Node came from your distro's repo or from NodeSource, the package manager removes it.
Debian / Ubuntu (apt):
sudo apt-get remove nodejs # remove the package
sudo apt-get remove --purge nodejs # also remove its config files
sudo apt-get autoremove # drop now-unused dependencies
# If you added the NodeSource repo, remove its source list and key too:
sudo rm -f /etc/apt/sources.list.d/nodesource.list
sudo rm -f /etc/apt/keyrings/nodesource.gpg
sudo apt-get updateRHEL / Fedora / Rocky / Alma (dnf):
sudo dnf remove nodejs
sudo rm -f /etc/yum.repos.d/nodesource*.repo # if NodeSource was usedmacOS Homebrew:
brew uninstall node # or: brew uninstall node@22
brew uninstall --force node # if multiple versions are linked
brew cleanup # remove old downloaded bottlesbrew uninstall node removes the formula and its symlinks in /opt/homebrew/bin (or /usr/local/bin on Intel), but the ~/.npm cache in your home directory is not brew-managed and survives. Clean it manually (next section).
A subtle apt gotcha: on older Ubuntu the distro ships both nodejs and a separate npm package. Run dpkg -l | grep -E 'nodejs|npm' and remove both if present, otherwise npm lingers as an orphan pointing at a deleted Node.
Remove a Docker Node image
There is nothing to "uninstall" inside a container; you remove the image and any containers based on it from the host.
docker ps -a --filter ancestor=node:22-alpine # find containers using it
docker rm <container-id> # remove stopped containers
docker rmi node:22-alpine # remove the image
# Sweep everything Node-image related at once:
docker images "node" -q | xargs -r docker rmi
docker image prune # drop dangling layersBecause the Node binary lives entirely inside the image layers, removing the image takes Node with it; there are no host-side leftovers (no ~/.npm on the host unless you bind-mounted it). The only thing to update afterward is the FROM node:... line in any Dockerfile you do not want to rebuild against.
The leftover-files checklist (the part everyone skips)
Removing the binary leaves three categories of state behind: the npm caches, the global package directory, and the PATH/shell-init lines. On a machine you are reusing, these are harmless clutter; on a machine you are handing over or trying to fix, they are the source of "I uninstalled Node but npm still half-works" confusion.
# npm + npx caches and config
rm -rf ~/.npm # the npm cache
rm -rf ~/.npmrc # only if you want config gone too
rm -rf ~/.node-gyp # cached node headers for native builds
rm -rf ~/.node_repl_history
# Global packages installed to a user prefix
rm -rf ~/.npm-global # if you set prefix=~/.npm-global
# (system prefix globals live in /usr/local/lib/node_modules, removed above)
# corepack / yarn / pnpm shims, if you used them
rm -rf ~/.cache/node ~/.local/share/pnpm ~/.yarnOn Windows the equivalents are %AppData%\npm, %AppData%\npm-cache, %LocalAppData%\npm-cache, and %UserProfile%\.npmrc (shown in the Windows section above).
Then clean your shell rc file. Open ~/.bashrc, ~/.zshrc, or ~/.profile and delete any of these blocks that a version manager added:
export NVM_DIR=...plus the twonvm.sh/bash_completionsource lines (nvm)eval "$(fnm env --use-on-cd)"(fnm)export VOLTA_HOME=...and thePATHline that prepends$VOLTA_HOME/bin(Volta)- any manual
export PATH="...node...:$PATH"you added by hand
A stale PATH export is the usual cause of node: command not found printed on every new shell after an "uninstall": the binary is gone but the rc file still tries to add its directory to PATH. Reload with source ~/.zshrc or just open a fresh terminal.
Verify Node is fully gone
which node || echo "node: gone"
which npm || echo "npm: gone"
which npx || echo "npx: gone"
command -v node >/dev/null && echo "still on PATH" || echo "clean"All four should report gone/clean in a new terminal (a current shell may have a cached path; hash -r clears bash/zsh's command cache, or just open a new window). On Windows, where node should print "Could not find files for the given pattern(s)".
If you only meant to switch versions rather than remove Node entirely, you do not need any of this; see how to update your Node.js version for the in-place upgrade path instead.
Troubleshooting
node: command not found on every new shell after uninstalling. A version manager's init line is still in your rc file pointing at a directory that no longer exists. Remove the NVM_DIR / fnm env / VOLTA_HOME block from ~/.bashrc or ~/.zshrc (see the checklist above) and open a fresh terminal.
npm still works after I removed node. You removed one install but another is still on PATH, or npm is symlinked to a global prefix that survived. Run which -a node npm (the -a shows every match) and remove the install you missed. A common case: you deleted the nvm Node but a /usr/local/bin/node from an old .pkg install is still there.
EACCES or "permission denied" deleting /usr/local/lib/node_modules. Those files are root-owned from a sudo-based install. Prefix the removal with sudo: sudo rm -rf /usr/local/lib/node_modules. Double-check the path before running it.
brew uninstall node says "node is required by ...". Another formula depends on Node. Either remove that formula first, or pass brew uninstall --ignore-dependencies node if you are sure you want Node gone regardless.
which node still prints a path after Homebrew uninstall. Your shell cached the old location. Run hash -r (bash/zsh) to clear the command cache, then re-check.
Two version managers were installed at once. Symptom: which -a node shows paths under both ~/.nvm and ~/.volta. Pick one to keep (or remove both), delete the other's directory and its rc-file init lines, and reload the shell. Mixing managers is the top cause of "uninstall did not take" reports.
See also
- How to update your Node.js version: if you actually want a newer Node rather than no Node, this covers the in-place upgrade for every install method (and the rebuild-native-modules step).
- Installing Node.js the right way: the reverse of this page, picking an install method that is easy to remove later.
- nvm vs fnm vs Volta: a side-by-side of the three version managers, including how cleanly each one uninstalls.
FAQ
Sources
Authoritative references this article was fact-checked against.
- Node.js downloads (official, nodejs.org)nodejs.org
- nvm (Node Version Manager) READMEgithub.com
- fnm (Fast Node Manager) READMEgithub.com
- Volta documentation (how Volta works)docs.volta.sh





