Skip to content

n

A simple command-line tool for downloading, switching, and removing Node.js versions on macOS and Linux.

Stars
19.5k
Forks
758
Licence
MIT
Language
Shell
Last update
19 days ago
Type
CLI

What it is

n is a command-line tool for installing and switching between different versions of Node.js. You run n with a version number like 20 or lts, and it downloads that version and makes it the active one. It keeps downloaded versions cached so you can switch back without downloading again.

  • Install the latest LTS release of Node.js with n lts
  • Install a specific version such as n 10.16.0 and switch to it
  • Pin a version per project using a .nvmrc or .node-version file with the auto label
  • Run a cached Node.js version for one command with n exec
  • Remove old cached versions with n prune

Great for

  • Developers who work on projects that need different Node.js versions
  • People on macOS, Linux, or WSL who want a minimal tool without shell profile changes
  • Users who prefer an interactive list to pick between installed versions

Not ideal for

  • Windows users running PowerShell or Git for Windows BASH, since the README says n does not work in those native shells
  • Users who need a version manager that works across many languages, since n only manages Node.js
  • Users who do not want to change file ownership or install paths, since the README notes permission issues may need a workaround
Step-by-step guide: how to use nInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js or npm, if installing with npm · Bash-compatible shell on macOS, Linux, or WSL

    Install n with npm (requires an existing Node.js install)

    npm install -g n

    Install the latest LTS version of Node.js

    n lts
  2. 2

    Run it

    • Install n with npm install -g n, or use Homebrew with brew install n on macOS
    • Run n lts to download and activate the latest LTS version of Node.js
    • Open a new shell if the active version does not change
    • Run n to open the interactive list of downloaded versions
  3. 3

    Get the most out of it

    • Add a .nvmrc or .node-version file to a project and use n auto to pick its version
    • Set N_PREFIX to a directory you own if the default location is not writable
    • Use n exec <version> <command> to run one command with a specific Node.js version
    • Use n -p <version> to keep your current npm version when switching Node.js versions

Downloads

Strengths

  • Simple commands with no shell subshells or profile setup, according to the README
  • Interactive selection of downloaded versions with arrow keys or j and k
  • Reads version files like .nvmrc and .node-version for per-project versions

Trade-offs

  • Does not support native Windows shells such as PowerShell
  • Requires permission changes or a custom N_PREFIX location if the default install directory is not writable
  • The README is truncated, so some details such as the full command list were not available to verify

How it compares

ProjectStarsTypeLevelUpdatedBest for
n (this)19.5kCLIbeginner19 days agoDevelopers who work on projects that need different Node.js versions
nvm95.7kDev toolbeginner8 days agoDevelopers who work on several Node.js projects that need different versions

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.