LinuxCommandLibrary

fnm

Manage multiple Node.js versions

TLDR

Install a specific version of Node.js

$ fnm [[i|install]] [node_version]
copy

Install Node.js LTS
$ fnm [[i|install]] --lts
copy

List all available Node.js versions and highlight the default one
$ fnm [[ls|list]]
copy

Use a specific version of Node.js in the current shell
$ fnm use [node_version]
copy

Set the default Node.js version
$ fnm default [node_version]
copy

Uninstall a given Node.js version
$ fnm [[uni|uninstall]] [node_version]
copy

SYNOPSIS

fnm [<options>] <command> [<args>]

PARAMETERS

-h, --help
    Print help information

-V, --version
    Print fnm version

env
    Export environment vars for shell integration (.node-version, .nvmrc)

install [<version>]
    Install Node.js version(s); latest if unspecified

ls, list
    List installed local Node.js versions

ls-remote [<version-pattern>]
    List available remote Node.js versions

use [<version>]
    Activate a Node.js version (auto from .node-version/.nvmrc)

current
    Show active Node.js version

default [<version>]
    Set/get default Node.js version

alias [<alias>] [<version>]
    Manage aliases for versions

uninstall [<version>]
    Remove installed Node.js version(s)

source
    Print shell code for fnm autoloading

completions [<shell>]
    Generate shell completions (bash, zsh, fish)

doctor
    Diagnose installation/environment issues

upgrade [--fnm-dir]
    Update fnm to latest release

DESCRIPTION

FNM (Fast Node Manager) is a high-performance tool for managing multiple Node.js versions on Linux, macOS, and Windows.

Built in Rust, it outperforms shell-based alternatives like nvm by using efficient shims and environment manipulation for instant switching. Key features include:
• Installing Node.js versions from official releases or custom sources.
• Automatic version detection via .node-version or .nvmrc files.
• Listing local/remote versions, setting defaults/aliases, and uninstalling.
• Shell integration for seamless use commands and env exports.

Ideal for developers juggling projects with varying Node requirements, FNM ensures no global pollution and supports npm/yarn/pnpm. Setup involves a one-time shell config (e.g., eval "$(fnm env)" in bashrc). It's lightweight (~10MB), secure (downloads verified), and actively maintained.

CAVEATS

Requires manual shell setup (e.g., eval "$(fnm env) " in ~/.bashrc); shims must be in PATH. Not suitable for global Node installs; Windows WSL may need extra config.

INSTALLATION

curl -fsSL https://fnm.vercel.app/install | bash
or cargo install fnm

SHELL INTEGRATION

Add to ~/.bashrc: eval "$(fnm env --use-on-cd)"
Supports auto-switch on directory change.

VERSION SOURCES

Supports official Node, Deno; custom via --repo-url.

HISTORY

Developed by Santiago Giménez in 2019 as a Rust-based nvm alternative for speed. Reached v1.0 in 2020; now at v1.35+ with LTS tracking, Windows support, and Cargo publish. GitHub: Schniz/fnm (stars: 20k+).

SEE ALSO

nvm(1), n(1), volta(1), asdf(1)

Copied to clipboard