Installing Node Version Manager (NVM)

Sim City LTD
2 min readJan 15, 2021

--

Having lightly dabbled in node before (requiring Postman Newman for the automated testing that I’m working on), I searched for best practices when using Node on Mac and came across Node Version Manager (NVM)

Simply put this is a cli version manager for node.js allowing you to maintain and select various versions of node.js depending on your needs.

I don’t require this yet but it’s good to future proof for this use case. Other reasons pushing this decision include:

  • Official node installation has some limitations better documented in other articles
  • Homebrew is an unsupported method of node installation, and while I’ve used it before, NVM seems like a superior alternative.

Installation steps:

  1. Install nvm using the latest link [15.01.21: -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash]
  2. Once complete, run the command offered by the installer rather than quitting and re-starting terminal. Something like:
  3. Install the version of node you want to install using the below for the latest version
nvm install node 

or specify a version with:

nvm install 6.14.4 

4. Quit terminal and see if nvm is still a valid command in terminal:

5. For me, I had to create a .zshrc file:

a. Open Terminal

b. Type touch ~/.zshrc to create the respective file. (touch command will create the .zshrc in your current directory but it will be hidden), hit return

c. Type open ~/.zshrc , hit return

d. once the file opens, add in the below, save and close.

source ~/.nvm/nvm.sh

6. You should now be able to open terminal and type the below commands to check that the source is now working correctly.

nvm lsnode

.

Sign up to discover human stories that deepen your understanding of the world.

--

--

Sim City LTD
Sim City LTD

Written by Sim City LTD

welcome to my personal stack overflow

No responses yet

Write a response