How to uninstall n and all node versions installed by n
You need to manually remove Node versions installed by n
and set the correct Node system version.
sudo n prune
sudo npm uninstall -g n
sudo rm -r /usr/local/n
sudo rm /usr/local/bin/node
See the following issues for n
on GitHub:
- Cant uninstall n and node #327
- Simple command to switch back to the system installation of Node #486
There have been some changes in n
, so I'll provide an updated and longer answer.
First some context. n
installs by default to /usr/local
. If that is also the location of the "system" install of node and npm then it is overwritten. The cache of previously downloaded versions is kept in /usr/local/n
.
Removing cached node versions downloaded by n
:
n prune
removes all but the version matching the active version of node- since
n
v3.0.0, deleting the active version is allowed usingn rm <version>
- (but just manually deleting
/usr/local/n
is easy and removes the top folder too!)
Removing installed node and npm and npx et al:
- since
n
v4.1.0, there isn uninstall
. (You will need to reinstall the system node and npm to keep using them if they were installed to same location and overwritten.)
Uninstalling n
itself: if you installed it with npm install n
then you uninstall it with npm uninstall n
. This does not affect the cached versions of node or the installed version of node, just n
. (And there is a small catch-22 if just deleted npm by running n uninstall
!)