How to easily switch between node versions using NVM

William S. Takayama
3 min readOct 25, 2020
nvm — node version manager

Turn your development flow easier when trying to deal with more than one node version

What is it?

It’s really interesting how we usually need to switch between different versions of node.js when we’re working in different projects. Think about it. Your job is currently using node version 12.19.0 and you’re trying to make a course which demands you to install a previous version of node (v. 6.17.0). “What should I do? Uninstall the current job version? Should I try to use both at the same time? But how????

Then you decide to download the previous version (6.17.0) and your whole job project crashes… WTF??? It’s kind of simple, each project has it own dependencies and works better in a specific node version (like Angular 9x works better with node version 10.13.x/12.11.x or later minor). When you install a new version you overwrite your job version - which works fine using version 12.19.0 - with an older version 6.17.0 and then your dependencies stop working.

This is where nvm comes into handy. It works as a node version manager (as the name already implies). “Okay, now that I already know that, how can I use it?

How to install and use NVM on Windows?

  1. Download nvm-setup.zip extract and install it (**I’d highly recommend you to install on /Public path**)
Installing nvm — please install on public path
  1. If you still don’t know the version you’ll be intalling then execute on your CLI (gitbash, powershell or windows terminal) the cmd nvm list available it’ll list all available node versions
List available node versions

3. Select your desired version then run cmd: nvm install <version>, for example: nvm install 6.17.0 . It’ll install your desired version on the machine with the correct npm version!

Install your desired version

4. Now (in this case) you’ll have two node versions on your machine - 6.17.0 and 12.19.0 -, so if you want to switch between versions just run: nvm use <version> e.g. nvm use 12.19.0 , if you want to check the current versions installed on your machine just run: nvm list

List and use specific node version

BONUS — If you have any global utilities already installed on your computer please reinstall all global utilities for each installed node version, e.g. suppose you have gulp-cli installed globally, then you need to run:

nvm use 6.17.0
npm install gulp-cli -g
nvm use 12.19.0
npm install gulp-cli -g

TIP: If you want to see more options just run: nvm

TIP — more commands to be used on nvm

--

--

William S. Takayama

Front-end developer who loves to learn new things and share. My biggest skill: Fast Learning with pragmatic resolution