.nvmrc Helper
Pick a Node.js version and generate a .nvmrc.
Overview
Pick a Node.js version (LTS or current) from a list, get back the one-line .nvmrc file you commit to your repo. The helper shows release status, end-of-life dates, and supported npm version for each release so you don't pin to something the runtime team is about to deprecate.
This is for teams using nvm, fnm, or Volta who want their Node version to switch automatically when developers cd into the project. Reach for it whenever you're aligning a repo to a specific LTS, upgrading off an end-of-life branch, or onboarding new contributors who need their local Node to "just work."
How it works
An .nvmrc file is a single line containing a Node version - either a full SemVer (20.11.0), a major (20), a major.minor (20.11), or an alias (lts/iron, node). nvm, fnm, asdf, and Volta all recognise the same file, walking up from the current directory to find one.
The helper writes the version with no leading v (which all major version managers accept) and no trailing newline issues, matching the conventions used by the nvm project itself.
Examples
- Pin to a specific LTS patch release:
20.11.1 - Pin to a major (resolves to latest installed/available
20.x):20 - Use the current active LTS:
lts/* - Pin to a named LTS line:
lts/iron
FAQ
Does .nvmrc work with fnm and Volta?
Yes. fnm reads .nvmrc by default; Volta reads volta config in package.json but also respects .nvmrc via volta install node. asdf reads .tool-versions instead but will fall back to .nvmrc with the legacy_version_file setting enabled.
Should I pin a major or a full version?
Pin a full version for libraries you ship to production - you'll get reproducible builds. Pin a major in libraries you publish to npm so consumers aren't tied to a patch release.
Where should .nvmrc live?
At the project root. Version managers search upward from the current directory, so deeper subprojects can override with their own file.
What's the difference between lts/* and node?
lts/* resolves to the latest LTS release line; node resolves to the latest stable (current) release, which may not be LTS.