LinuxCommandLibrary

fnm

Manage multiple Node.js versions

TLDR

Install a specific version of Node.js

$ fnm install [node_version]
copy

List all available Node.js versions and highlight the default one
$ fnm 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 uninstall [node_version]
copy

SYNOPSIS

fnm [command] [arguments]

PARAMETERS

install [version]
    Installs a specific Node.js version. If no version is specified, installs the version specified in .node-version or .nvmrc.

use [version]
    Uses a specific Node.js version for the current shell. If no version is specified, uses the version specified in .node-version or .nvmrc.

default [version]
    Sets the default Node.js version to use.

list
    Lists all installed Node.js versions.

uninstall [version]
    Uninstalls a specific Node.js version.

alias [target] [name]
    Creates or updates an alias for a Node.js version.

unalias [name]
    Removes an alias.

env
    Prints the environment variables needed to use fnm.

completions
    Prints shell completions.

version
    Displays the fnm version.

help
    Displays help information.

DESCRIPTION

fnm is a fast and cross-platform Node.js version manager, built in Rust.
Unlike nvm, fnm is designed for speed and efficiency. It downloads pre-built Node.js binaries, minimizing build times and resource consumption.
It is designed to be shell-agnostic, supporting various shells like bash, zsh, fish, and more. fnm allows users to easily install, manage, and switch between multiple Node.js versions on a single system.
This is particularly useful for developers working on multiple projects with different Node.js version requirements.
It supports .node-version files which allows it to automatically switch node versions in a directory if one is found.

CAVEATS

fnm relies on pre-built Node.js binaries.
If a specific version is not available as a pre-built binary for your platform, installation may fail.

INSTALLATION

fnm can be installed using various methods, including curl, and package managers like Homebrew and Scoop.

CONFIGURATION

fnm stores installed Node.js versions in a dedicated directory. This directory is configurable via environment variables. It also supports `.node-version` or `.nvmrc` files for automatic version switching.

HISTORY

fnm was created as an alternative to nvm with a focus on performance and portability.
Being written in Rust gives it the advantages of a fast and cross-platform experience. Its popularity has grown with the increasing need for efficient Node.js version management across diverse development environments.

SEE ALSO

nvm(1), npm(1), yarn(1)

Copied to clipboard