In this article we are going to learn to uninstall nvm and node-js. We should install node-js using nvm so that we can manage multiple version of node in our machine.
We have tested the process today (14th of June 2019) on a MacBook Pro and a machine having ubuntu 18 LTS.
First of all we will have remove the path of .nvm folder from your machine, to achieve this you will have execute following command.
rm -rf "$NVM_DIR" # This will remove the path of .nvm folder from your machine
Installation procedure of nvm might have added few instruction in your .bashrc file (for ubuntu) and .profile (MacBook Pro).
We need to remove that as well to do that delete this snippet from your instruction file.
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [[ -r $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion
if you type nvm now it should give command not found, but the job is not done. Multiple version of nodejs is still present in your system under ~/.nvm/versions/node directory.
If you are not planning to use them again you will have manually remove this folder as well, by executing following command from your terminal.
rm ~/.nvm # Removes every version of node-js which is installed by nvm install <version number> command sudo rm ~/.nvm # If root privileges are required