Thanks to Volta, managing multiple versions of Node is no longer a pain.
Under the covers, all the Node version managers are doing the same thing: setting up symlinks to different versions of Node installed on your computer. The difference between them is how they manage those symlinks. If you know the correct version of Node for the project you are currently working on, you can use nvm to set it to the active version, and all is well, as long as you remember to do so. The problem here is that you need to know the correct version of Node. And if you're switching from a project that has different Node version requirements, you have to remember to switch each time you open one of those projects. As Wes Bos would say, that's no way to live your life. That's what barbarians do.
Volta takes a set-it-and-forget-it approach. You "pin" the version of Node you need for your project and Volta auto-magically switches to that version anytime you are working on that project, without any action on your part. You can have multiple projects open at the same time, each with their own, different versions of Node, running simultaneously.
"Because Volta’s toolchain always keeps track of where you are, it makes sure the tools you use always respect the settings of the project you’re working on. This means you don’t have to worry about changing the state of your installed software when switching between projects."
Go to the getting started page on the Volta site and follow the instructions for your operating system.
Pin the version of Node you want to your project by running the pin
command in the root folder of your project. For example:
volta pin node@14
Volta adds an entry to your package.json.
{
...
"volta": {
"node": "14.18.0"
}
}
Now anyone on your team that has Volta installed will get the benefit of having the correct version of Node pinned. If you don't have the specified version of Node, Volta will download and install it for you, then switch to that version. For any barbarians that may also be working on your project, the entry won't affect them, but will allow them to see the version of Node they'll need to use.
Volta is written in Rust and is completely cross-platform, working in Windows and in all Unix shells.
As web developers, we have more than enough things to worry about. Using Volta means that managing Node versions is no longer one of them.