How to uninstall n and all node versions installed by n

BuZZ-dEE picture BuZZ-dEE · Apr 4, 2018 · Viewed 14.5k times · Source

I have installed some Node.js versions with the tool n. I have uninstalled all Node.js versions using:

sudo n prune

except the current (activated) version. If I try to unsinstall the current version:

sudo n rm 6.10.2

I get the following error.:

Error: cannot remove currently active version (node/6.10.2).

I can not figure out, how to set the systems (Arch Linux) default Node.js version, which is already installed and was used to install n.

If uninstall n using:

sudo npm uninstall -g n

it leaves the current version on my computer.

ls /usr/local/n/versions/node/                                                                                                                                                                      
6.10.2/

Do I need to manually delete the folder: /usr/local/n/? Or, is there an option in n to uninstall it and all the Node.js versions installed by n, so that I get the setting before I installed n?

Answer

BuZZ-dEE picture BuZZ-dEE · Apr 5, 2018

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: