Skip to content

Instantly share code, notes, and snippets.

@ChanManChan
Last active April 3, 2020 15:28
Show Gist options
  • Select an option

  • Save ChanManChan/c1c8d62194e6ca6ce3647c2a0732a0ca to your computer and use it in GitHub Desktop.

Select an option

Save ChanManChan/c1c8d62194e6ca6ce3647c2a0732a0ca to your computer and use it in GitHub Desktop.

I think the best way to manage node.js is to use NVM. NVM stands for Node Version Manager.

It's a must-have tool for node.js developers!

You can install NVM using the following command, open terminal and run any one of the following:-

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

or

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

After installing this it's recommended to close the current terminal and open a new one since NVM will be adding some environment variables so terminal needs to be restarted.

I'll list down some of the basic commands for using NVM.

This will fetch all the node versions from the internet. All node versions from beginning till date will be shown, It will also mention LTS versions alongside.
nvm ls-remote 
This will install the node version which you want (version list is obtained using the above command)
nvm install v10.15.1
This command will give us the list of node versions that are installed locally
nvm ls
This command is used to remove the node version that you want from your computer
nvm uninstall v10.15.1
The following command will help you upgrade to the latest working npm on the current node version
nvm install-latest-npm
NVM can be used to manage multiple node versions simultaneously
It can also help you install all the global npm packages from one version to another instead of manually installing each one of them!
There are many other uses of nvm the details of which and the commands can be found here Node Version Manager

https://github.com/nvm-sh/nvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment