

In your home directory, create a directory for global installations: mkdir ~/.npm-globalĬonfigure npm to use the new directory path: npm config set prefix '~/.npm-global' In my case v12.14.1 and v13.7.0 both are installed, to switch I have to just use nvm use 12.14.1 Now switch between node versions $ nvm ls Nvm install 8.10.0 # just put the node version number You can also use two different versions of node using nvm easily Npm should also be installed with node, verify it using npm -v Once the installation is completed, verify it by printing the Node.js version: node -version Installing Node.js and npm nvm install node Once the script is in your PATH, verify that nvm was properly installed by typing: nvm -version "$NVM_DIR/bash_completion" # This loads nvm bash_completionĪs the output above says, you should either close and reopen the terminal or run the commands to add the path to nvm script to the current shell session. The command above will clone the NVM repository from Github to the ~/.nvm directory:Ĭlose and reopen your terminal to start using nvm or run the following to use it now: export NVM_DIR="$HOME/.nvm" Installing NVM (Node Version Manager) by downloading and running a script curl -o- | bash

You can verify your uninstallation by these commands they should not output anything. Go to home directory and remove any node or node_modules directory, if exists. Sudo rm -rf /usr/local/share/man/man1/node* npm folders from your system sudo rm -rf /usr/local/bin/npm

Removing Nodejs and Npm sudo apt-get remove nodejs npm node Note: This will completely remove nodejs from your system then you can make a fresh install from the below commands.
