Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Node's release cadence is fast: even-numbered majors (18, 20, 22) are LTS for ~3 years, odd-numbered are not. You'll have multiple Node versions on one machine. nvm is the venerable choice (shell-only); volta is the rust-written newer option (faster, project-pinned auto-switching); corepack is Node-builtin and manages package managers (pnpm, yarn) without global installs. Pick one and stick with it.
Node version managers solve a real problem: different projects require different Node.js versions, and switching them manually invites version drift and subtle incompatibilities. nvm (Node Version Manager) is the original and most widely used — it manages versions per shell session via .nvmrc files — while volta pins versions per-project in package.json and automatically switches without any shell configuration. Knowing which tool your team uses and why version pinning matters is the difference between a reproducible development environment and a 'works on my machine' nightmare.
node --version, then install a different major version, and switch with nvm use or auto-switching..nvmrc (or volta block in package.json) pinning Node 22. cd in and verify the right version is active.corepack enable. Now pnpm and yarn are available without global installs.volta install pnpm to pin pnpm at the user level. Run pnpm --version from anywhere.Use these three in order. Each builds on the one before.
In one paragraph, explain why I shouldn't use the `node` that comes with Homebrew or `apt-get` for serious work — and what 'pin Node per project' means.
How does nvm change which `node` is on my PATH when I `nvm use`? Walk through the shell function and the per-version dir layout.
Compare nvm, volta, fnm, and Docker for Node version management on a 5-person team in 2026. Recommend a strategy and defend it.
# nvm (mac/linux):
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
$ nvm install 22 && nvm use 22
# volta (rust-based, auto-switches per project):
$ curl https://get.volta.sh | bash
$ volta install node@22
# pin Node per project:
$ echo "22" > .nvmrc # nvm reads this
$ # OR with volta — set in package.json:
$ cat package.json
{
"name": "myapp",
"volta": { "node": "22.4.0", "pnpm": "9.4.0" }
}
# corepack — manages pnpm/yarn:
$ corepack enable
$ corepack prepare pnpm@9.4.0 --activate
$ pnpm --versionnode main.js