nvm: Node.js version manager for POSIX shells
Per-user Node.js version manager for switching between installed versions via command line on POSIX-compliant shells.
Learn more about nvm
nvm is a version management tool for Node.js that operates as a set of shell functions loaded into POSIX-compliant shell environments rather than as a standalone executable. It works by dynamically modifying the shell's PATH environment variable to point to different Node.js installations stored in isolated directories within the user's home directory, enabling per-shell version switching without requiring system-level permissions. The tool supports automatic version detection through configuration files that specify which Node.js version a project requires, triggering the appropriate PATH manipulation when entering project directories. nvm maintains a local registry of available Node.js versions and downloads binary distributions on demand, storing each version in a separate subdirectory to prevent conflicts. This architecture allows multiple Node.js versions to coexist on a single system while maintaining complete isolation between installations, though the shell-function approach means it must be sourced into each shell session rather than being globally available as a system command.
POSIX-compliant implementation
Written as a bash script that works across any POSIX-compliant shell (sh, dash, ksh, zsh, bash) rather than being shell-specific, enabling consistent behavior across different Unix-like environments and shells.
Per-user installation model
Installs to the user's home directory (~/.nvm) without requiring system-wide permissions or administrative access, allowing multiple users on the same system to maintain independent Node version configurations.
.nvmrc file integration
Supports project-level version specification through .nvmrc files, with optional shell integration to automatically switch Node versions when entering directories, enabling version consistency across development teams.
// .nvmrc file in project root
// 16.9.1
// In your Node.js script, verify version matches
const { execSync } = require('child_process');
const fs = require('fs');
const requiredVersion = fs.readFileSync('.nvmrc', 'utf8').trim();
const currentVersion = process.version.slice(1);
if (!currentVersion.startsWith(requiredVersion)) {
console.error(`Expected Node ${requiredVersion}, got ${currentVersion}`);
process.exit(1);
}Fixed node version detection in the install latest npm functionality.
- –nvm install_latest_npm: fix node version detection
Enhanced installation script with zsh support and improved package management.
- –install.sh: add $ZDOTDIR to zsh search
- –reinstall-packages: do not reinstall corepack
- –avoid bash-specific syntax
- –install-latest-npm: npm v11 is out
- –nvm install_latest_npm: avoid unbound variable
Fixed various issues with argument quoting, variable handling, and binary downloads.
- –nvm_download: ensure all args are quoted
- –--save: avoid a conflict with set -e
- –nvm_has_colors: avoid an aliased tput
- –declare an unbound variable
- –nvm install -b: do not attempt to download source on a failed binary download with -b
See how people are using nvm
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
Biome
Unified toolchain providing fast formatting and linting for JavaScript, TypeScript, CSS, and JSON with CLI and LSP.
jsdom
Pure JavaScript implementation of web standards for Node.js.
Lighthouse
Open-source tool that analyzes web pages for performance, accessibility, and SEO, generating actionable reports.
Corepack
Enforces package manager versions specified in package.json.
CXX
Safe FFI library for calling C++ from Rust and vice versa with zero-overhead bindings via code generation.