Nvm

Node Version Manager

Multiple Node Environments are a Pain to Develop In Locally

NVM is a simple bash script to manage multiple active node.js versions.

NVM install on MacOs

Curl command:

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


quit the terminal program and reopen it and type to see weather nvm installed or not :

$ command -v nvm

>>> nvm


NVM is simple to use. Here’s the commands you’ll need to know when you want to work with NVM in the command line.

$ nvm ls-remote

This shows you all available LTS versions of Node.js.


nvm ls : Shows you all installed versions available locally on your machine

$ nvm ls

Usage

nvm install node OR nvm install 10.18.0

Typing nvm install node will install the latest version of Node.js to your machine

$ nvm install node

nvm install <SPECIFIC_NODE_VERSION> will install the specified version.

$ nvm install 10.18.0 #<SPECIFIC_NODE_VERSION>

to use installed node versions

nvm use node OR nvm use 11.10.0

$ nvm use node

or

$ nvm use 11.10.0


nvm run node OR nvm run 11.10.0

This command is almost the same as the one above, the only difference is typing nvm run node or nvm run --version like nvm run 11.10.0 will switch to the specified version of Node.js and open up a Node command line for you to run commands manually from afterwards.

$ nvm run node

nvm alias default node OR nvm alias default 11.10.0

These commands will set an NVM alias called ‘default’ to the latest downloaded version of node with nvm alias default node, or the specified version with nvm alias default --version like nvm alias default 11.10.0.

$ nvm alias default node 
$ nvm alias default 11.10.0