Run multiple NodeJS versions with Node Version Manager (NVM) — for MacOS

Sherlynn
3 min readJan 27, 2019

If you use Node.js for your applications, you may want to use different versions of Node. Fortunately, there is a tool to manage them all using Node Version Manager.

Node.js

Node.js is an open source JavaScript run-time environment used for making web servers and other networking tools.

Node.js uses an event-driven, non-blocking I/O model unlike other server-side platforms e.g. PHP whereby functions tend to block until completion, which means that commands execute one at a time. In, Node.js, commands are executed in parallel, and callbacks are used to determine completion or failure.

Node.js Version Updates

A new release of Node.js is cut from the GitHub master branch every six months. Whenever a new odd-numbered version comes out, the most recent even version goes to long-term support, or LTS. Versions under LTS receive active support for 18 months followed by an additional 12 months of maintenance support.

What is Node Version Manager (NVM)?

Node Version Manager is a tool that allows programmers to seamlessly switch between different versions of Node. With NVM, you can easily switch and install each Node version with a simple command line interface command. In addition, you can also set a default version for use.

When you are faced with bugs, using a version manager makes it simple to switch node versions for quick troubleshooting. Otherwise, it would be tedious and time-consuming to have to uninstall and reinstall node versions and their global packages.

Installing NVM for MacOS

Install Node Version Manager using either cURL or Wget.

For cURL, run the following from your terminal:

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

The above commands will clone the repository to ~/.nvm and apply changes to your bash profile and that allows…