NVM Essentials: A Beginner-Friendly Guide to Node.js Versioning

Ashish Singh
2 min readMay 16, 2024

Node Version Manager, or NVM for short, is like a magic wand for Node.js developers. It helps you manage different versions of Node.js on your computer without breaking a sweat. Let’s dive into what NVM is, how to set it up, and how to make the most out of it in simple terms.

What’s NVM and Why Do You Need It?

Picture this: you’re working on multiple projects, each needing a different version of Node.js. Manually switching between these versions is a headache. That’s where NVM swoops in to save the day!

NVM does a few cool things:

  1. Version Variety: It lets you install and switch between different versions of Node.js smoothly. No more compatibility issues!
  2. Neat and Tidy: Each Node.js version you install with NVM stays in its own little corner, so they don’t mess with each other. It’s like having separate rooms for your different projects.
  3. Easy-Peasy Management: With NVM, installing, uninstalling, and switching Node.js versions is a piece of cake. You just need a couple of simple commands.

Let’s Get NVM Up and Running

Setting Up

  1. Snag NVM: Go to the NVM GitHub page and follow the instructions to install it on your computer.
  2. Node.js Galore: Once NVM is up and running, you can start installing different Node.js versions using a command like nvm install <version>.
  3. Pick a Fave: If you have a favorite Node.js version, set it as the default using nvm alias default <version>.

Making NVM Work Its Magic

Getting Node.js Versions

To get a specific Node.js version, just tell NVM to fetch it for you:

$ nvm install 14.17.0

Switching Between Versions

Need to work on an older project? No problem! Use this command to switch Node.js versions:

$ nvm use 14.17.0

Setting a Default Version

If you’re always using one Node.js version, set it as the default so you don’t have to keep switching:

$ nvm alias default 14.17.0

Checking Your Options

To see all the Node.js versions you have installed, ask NVM to list them for you:

$ nvm ls

Cleaning House

If you’re done with a Node.js version, kick it to the curb with:

$ nvm uninstall 14.17.0

Wrapping Up

Node Version Manager (NVM) is like your Node.js superhero, making managing different versions a breeze. With NVM, you can install, switch, and manage Node.js versions effortlessly, making your development life a whole lot easier. So go ahead, set up NVM, and let the Node.js adventures begin!

--

--