n – Node.js Version Manager

10.2.0 · active · verified Sun Apr 19

n is a command-line interface (CLI) tool designed for interactively managing Node.js versions on Unix-like systems, including macOS and Linux (with WSL support). It distinguishes itself from alternatives like nvm by avoiding subshells and complex profile setups, offering a simple and direct approach to switching Node.js environments. The current stable version is 10.2.0, with minor and patch releases occurring every few weeks to months, and major versions less frequently, typically driven by significant internal changes or feature additions. Key differentiators include its simplicity, direct control over installed Node.js binaries, and a lack of shell modification, making it a straightforward choice for developers who prefer minimal environmental interference. It caches Node.js versions locally and allows for quick installation and activation of different versions.

Common errors

Warnings

Install

Quickstart

Demonstrates global installation of 'n', installing and switching between Node.js versions, running commands with specific versions, and basic version management operations.

# Install n globally using npm (requires Node.js to be pre-installed or n to be bootstrapped first)
npm install -g n

# Or, bootstrap install if npm/Node.js is not yet available, then install n
# curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s install lts
# npm install -g n

# Install the latest LTS (Long Term Support) version of Node.js
n lts

# Install a specific Node.js version (e.g., 18.17.1)
n 18.17.1

# Switch to a specific Node.js version interactively
n
# Use arrow keys to select and Enter to activate

# Run a command with a specific Node.js version without changing the global default
n use 18.17.1 my-script.js

# See currently installed Node.js versions and the active one
n ls

# Remove a specific Node.js version
n rm 14.17.6

# Clean up cached versions not currently in use
n prune

# Install the latest stable version of Node.js
n latest

view raw JSON →