web dev//runtime//Node.js//version manager
A version manager is a tool that installs several versions of a runtime side by side and switches between them per project, so that each codebase runs on the exact Node.js (or Python, or Ruby) it was written for. In the Node.js world the two common ones are nvm and Volta.
A version manager is a tool that installs several versions of a runtime side by side and switches between them per project, so that each codebase runs on the exact Node.js (or Python, or Ruby) it was written for. In the Node.js world the two common ones are nvm and Volta.
The problem it solves is mundane and constant. One project was built on Node 14 and breaks on 22; another needs 20. With a single system-wide Node, every switch between them means uninstalling and reinstalling, and a teammate on a different version sees errors nobody else can reproduce.
nvm installs versions and switches the shell between them: nvm install 14.17.0, then nvm use, which reads the version from a .nvmrc file at the project root. The switch is per terminal session, so forgetting it runs the wrong Node silently.
Volta pins the toolchain inside the project itself: volta pin node@20 writes the version into package.json, and Volta then picks the right Node (and npm, and global tools) automatically whenever a command runs in that folder, with no step to forget.
The pin is the record that matters. A version written in the repository (.nvmrc, Volta's field, or the engines field of package.json) turns works on my machine into a checkable statement, and CI can read the same file.
Reproducing a build means pinning every layer: the runtime with a version manager, the packages with a lockfile, the operating system with a container.
Each tool fixes one layer and leaves the others free.
A version manager is often confused with npm: npm pins the packages a project uses, the version manager pins the runtime that executes them, and a lockfile cannot say which Node will run it. The layer below, the operating system and its libraries, is what a Docker image pins.