Repolode
tj

tj/n

A minimal bash-based CLI for installing, switching, and removing multiple Node.js versions on macOS and Linux.

Open-source alternative to:nvm

Stars
19,510
Forks
758
Open issues
1
Last commit
19 days ago

What is it?

n is a command-line tool for managing multiple Node.js versions. You run `n <version>` to download and activate a specific release, `n lts` for the latest long-term support build, or run `n` with no arguments to pick from already cached versions with arrow keys. It avoids subshells and shell profile edits, so the active version is simply the one linked into your PATH prefix.

Versions can be specified in several ways: full or partial numbers like `8` or `v6.1`, labels such as `lts`, `latest` and `current`, release codenames, nightly builds, and `auto`, which reads `.n-node-version`, `.node-version`, `.nvmrc`, or the `engines` field in package.json. Downloaded versions stay in a cache, so they can be reinstalled quickly, run with `n run`, or used for a single command with `n exec`.

The tool supports macOS, Linux, WSL, and other Unix-like systems, and can be installed through npm, Homebrew, or MacPorts. A custom mirror can be set through `N_NODE_MIRROR`, which is useful in regions where the default download server is slow, and architecture can be overridden for cases like Alpine musl builds.

Key features

  • 01Install and switch Node.js versions with a single command such as `n lts` or `n 20`.
  • 02Interactive picker to select, install, or delete cached versions.
  • 03Reads target version from .n-node-version, .node-version, .nvmrc, or package.json engines.
  • 04Run or locate a cached Node.js version without reinstalling, using `n run`, `n which`, or `n exec`.
  • 05Supports custom mirrors and architecture overrides via environment variables.

Use cases

  • Switching between Node.js versions across several projects on a development machine.
  • Installing a pinned Node.js version in CI or a Docker container with `--cleanup`.
  • Working around slow default downloads by pointing n at a regional mirror.
  • Running a project's scripts under a specific Node.js version with `n exec`.

Quick start

  1. 1

    Install n via npm (requires Node.js already installed)

    npm install -g n
  2. 2

    Install the latest LTS Node.js version

    n lts

Things to know

  • Supports macOS and Linux (including WSL) only; does not work in native Windows shells like PowerShell.
  • Installing globally to the default /usr/local may require changing directory ownership or using a custom N_PREFIX.

In collections

Topics

FAQ

What is n?
A minimal bash-based CLI for installing, switching, and removing multiple Node.js versions on macOS and Linux. n is a command-line tool for managing multiple Node.js versions. You run `n <version>` to download and activate a specific release, `n lts` for the latest long-term support build, or run `n` with no arguments to pick from already cached versions with arrow keys. It avoids subshells and shell profile edits, so the active version is simply the one linked into your PATH prefix.
Is n free to use? What license does it have?
n is open source under the MIT license. Check the license terms before using it in commercial products.
Is n still maintained?
Actively maintained. The last commit to n was on Oct 18, 2026.
What can I use n for?
Switching between Node.js versions across several projects on a development machine. Installing a pinned Node.js version in CI or a Docker container with `--cleanup`. Working around slow default downloads by pointing n at a regional mirror. Running a project's scripts under a specific Node.js version with `n exec`.
How do I install n?
Install n via npm (requires Node.js already installed): npm install -g n Install the latest LTS Node.js version: n lts
Where can I get n?
The source code and installation instructions are on GitHub: https://github.com/tj/n

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects