Navigate:
~$NVM0.2%

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.

LIVE RANKINGS • 10:20 AM • STEADY
OVERALL
#195
18
DEVELOPER TOOLS
#36
6
30 DAY RANKING TREND
ovr#195
·Devel#36
STARS
91.9K
FORKS
9.9K
7D STARS
+169
7D FORKS
+37
See Repo:
Share:

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.

nvm

1

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.

2

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.

3

.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);
}


vv0.40.3

Fixed node version detection in the install latest npm functionality.

  • nvm install_latest_npm: fix node version detection
vv0.40.2

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
vv0.40.1

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

Loading tweets...


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers