LinuxCommandLibrary

nvm.fish

Manage Node.js versions

TLDR

Install a specific version of Node.js

$ nvm install [node_version]
copy

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

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

List all available Node.js versions and highlight the default one
$ nvm list
copy

Uninstall a given Node.js version
$ nvm uninstall [node_version]
copy

SYNOPSIS

nvm command [args]

PARAMETERS

install
    Install a specific Node.js version.

uninstall
    Uninstall a specific Node.js version.

use
    Switch to a specific Node.js version.

ls
    List installed Node.js versions.

ls-remote
    List available Node.js versions online.

current
    Display the currently used Node.js version.

alias
    Create an alias for a Node.js version.

unalias
    Remove an alias.

version
    Show nvm.fish version

DESCRIPTION

nvm.fish is a Fish shell implementation of Node Version Manager (NVM). It allows you to easily install and manage multiple active Node.js versions.
This is particularly useful for developers working on projects with different Node.js version requirements. Instead of manually installing and switching between Node.js versions, nvm.fish provides a simple command-line interface for installing, uninstalling, and switching between Node.js versions.

Unlike the Bash-based nvm, nvm.fish is designed to be fully compatible with the Fish shell syntax. It uses Fish functions and variables to provide a seamless user experience. It simplifies the process of managing Node.js versions and makes it easy to test your code against different Node.js environments. This helps in ensuring compatibility and preventing version-related issues.
Common usages include setting a project specific `.nvmrc` file for consistent Node.js runtime version and allowing contributors to easily use the correct environment when developing. When you enter a directory containing that file, `nvm.fish` will automatically switch to the version specified in the file.

CAVEATS

Requires Fish shell to be installed. The Fish configuration files need to be setup correctly to properly load nvm.fish on shell initialization. The nvm.fish command must be sourced in your Fish configuration file (typically `~/.config/fish/config.fish`).

INSTALLATION

To install nvm.fish, you can typically use a package manager like `fisher` or `oh-my-fish`. Alternatively, you can clone the repository and manually source the `nvm.fish` file in your Fish configuration.

VERSION SPECIFICATION

The `` argument can be a specific version number (e.g., `16.0.0`), `latest` to install the latest version, `lts/*` to install the most recent LTS version, or an alias like `default`.

SEE ALSO

node(1), npm(1)

Copied to clipboard