Why you need a Node version manager
Different projects need different Node.js versions. One app runs on the current LTS, an older one is stuck on a release that no longer gets updates, and a new project wants the latest. Installing Node once, system-wide, forces you to pick one. A version manager lets each project use its own.
The three popular options are nvm, fnm and Volta. In the nvm vs fnm comparison, the main difference is speed and design. Volta goes further by pinning versions inside package.json.
nvm: the long-standing default
nvm (Node Version Manager) is a shell script and the tool most tutorials mention. It works in bash and zsh on macOS and Linux. On Windows you want the separate nvm-windows project, which is a different codebase with similar commands.
nvm install --lts
nvm use --lts
nvm alias default lts/*
- Pins a version with: a
.nvmrcfile, thennvm use. - Good: huge community, plenty of documentation.
- Downside: being a shell function, it adds noticeable time to every new terminal, and it does not switch versions automatically when you
cdinto a project unless you add extra shell config. It also does not support fish out of the box.
fnm: fast and mostly drop-in
fnm (Fast Node Manager) is written in Rust. It starts almost instantly, works on macOS, Linux and Windows, and reads the same .nvmrc files as nvm, as well as .node-version.
fnm install --lts
fnm use lts-latest
fnm default lts-latest
To switch versions automatically as you move between project folders, add this to your shell config:
eval "$(fnm env --use-on-cd)"
- Pins a version with:
.nvmrcor.node-version. - Good: speed, auto-switching, works with bash, zsh, fish and PowerShell.
- Downside: a smaller ecosystem than nvm, so fewer Stack Overflow answers.
Volta: pin versions in package.json
Volta is also written in Rust, but it works differently. Instead of changing your shell, it installs small shims for node, npm and other tools, and picks the right version based on the project you are in.
volta install node@lts
volta pin node@lts
volta pin writes the version into the volta section of package.json, so everyone on the team gets the same Node version without needing a separate file. Volta can also pin package managers and global tools.
- Pins a version with:
package.json. - Good: pinned versions travel with the repo, no shell configuration, and consistent behaviour across machines.
- Downside: a different workflow from nvm, and global installs go through
volta installrather than plainnpm install -g.
nvm vs fnm vs Volta: which should you choose?
- Want the least friction and the speediest terminal? Pick fnm.
- Already use nvm and it works? Stay with nvm. Switching only for speed is optional.
- Working in a team that needs identical versions? Try Volta, or commit an
.nvmrcand use fnm. - On Windows? fnm and Volta both work natively. nvm needs the separate nvm-windows.
Moving from nvm to fnm
If you decide to switch, the migration is short. Run nvm ls to see which versions you rely on, and npm ls -g --depth=0 to note your global packages. Install fnm, install those Node versions with it, and reinstall the global packages. Because fnm reads your existing .nvmrc files, your projects need no changes.
Finally, remove the nvm lines from your shell config so the two tools do not fight over the PATH, and open a new terminal to check node -v shows the version you expect.
Whichever you choose, commit the version file to your repository. Pinning the version in the project is worth more than the choice of tool.

Leave a Reply
You must be logged in to post a comment.