Use Multiple Versions of NodeJS on Windows

Whether you’re coming from linux, or are new to node. You’re probably going to need to work with multiple versions of node at some point. Whether you’re working on multiple projects or want it for testing purposes, a node version manager is a very useful tool. On linux it’s easy, just install nvm and you’re set. On windows it’s not that simple… or is it?

nvm-windows to the rescue!

It’s a fully-featured command line node version manager for Windows. It even comes with a simple gui installer, which is great.

A list of nvm-windows commands

Here are the steps to getting up and running with nvm-windows

  1. If you have any version of node installed already, make sure to uninstall it first. Make sure to also remove any remaining node and npm directories (e.g. “C:\Program Files\nodejs” and “C:\Users\<user_name>\AppData\Roaming\npm”)
  2. Get the installer from the releases page: https://github.com/coreybutler/nvm-windows/releases
  3. Go through the installation process, nvm will be added to your PATH automatically
  4. Run cmd or any terminal emulator you might be using
  5. Use the command nvm install version_number where version_number is the version of node you want to install (e.g. 8 or 10)
  6. Repeat the above command for every version you need
  7. Finally, run nvm use full_version_number where full_version_number is the full version of node you want to currently use (e.g. 8.16.0 or 10.0.0)

Can I use Yarn with nvm-windows?

Yes… but… Unfortunately, there are some issues with using yarn alongside nvm-windows. Basically, if you want to use yarn with nvm-windows, you will have to uninstall yarn (If you installed it using the gui installer). Then you will have to install it using npm install --global yarn every time you switch the node version. There are also issues when installing packages globally with yarn (https://stackoverflow.com/questions/43108816/can-yarn-and-nvm-coexist-on-windows), so you may have to use npm for that anyway.

What about WSL?

If you’re coming from linux you might be tempted to try running the regular nvm on WSL. It might work for you, but I personally had many issues with it, so I don’t recommend it. WSL2 might solve those issues though, so fingers crossed.

More info

If you need further information, run nvm without any arguments to show the list of available commands or visit the GitHub page of the project: https://github.com/coreybutler/nvm-windows

--

--

--

I write about web development tips & news. Follow me on twitter for more: twitter.com/HadrysMateusz

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Day 44 Training at Ryaz: Learning React

Putting Context into useContext

Day 61 Training at Ryaz: Learning React

The journey to building a full microservice app. Changing the Angular frontend to micro frontend.

Install .NET 6 SDK Manually on M1 Mac

Introduction to Modern JavaScript

Complete React Installation

Common and realize help wear than to.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mateusz Hadryś

Mateusz Hadryś

I write about web development tips & news. Follow me on twitter for more: twitter.com/HadrysMateusz

More from Medium

Why Should You Use Node JS ?

SE3050 -Application Frameworks Blog — 03

How To Make Your NodeJS Application Secure?

Capture the flag: A Node.js web app vulnerability practice (part 1)