LinuxCommandLibrary

install-nodeversion

Install specific versions of Node.js

TLDR

Install a specific Node.js version

$ Install-NodeVersion [node_version]
copy

Install multiple Node.js versions
$ Install-NodeVersion [node_version1 , node_version2 , ...]
copy

Install latest available version of Node.js 20
$ Install-NodeVersion ^20
copy

Install the x86 (x86 32-bit) / x64 (x86 64-bit) / arm64 (ARM 64-bit) version of Node.js
$ Install-NodeVersion [node_version] -Architecture [x86|x64|arm64]
copy

Use a HTTP proxy to download Node.js
$ Install-NodeVersion [node-version] -Proxy [http://example.com]
copy

SYNOPSIS

install-nodeversion [OPTIONS] <VERSION>

PARAMETERS

-h, --help
    Display help message and exit.

-v, --version
    Show install-nodeversion version info.

-d DIR, --dir=DIR
    Install to custom directory DIR instead of default ~/.nodeversions.

--lts
    Install the latest LTS version (overrides VERSION).

--current
    Install the current stable release.

--nightly
    Install the latest nightly build.

--arch=ARCH
    Override architecture (e.g., x64, arm64).

-y, --yes
    Skip confirmation prompts.

DESCRIPTION

The install-nodeversion command is a utility for downloading and installing specific versions of Node.js on Linux systems. It fetches pre-built binaries directly from the official Node.js distribution servers, extracts them to a user-specified directory, and optionally updates the system PATH. This tool is particularly useful for developers needing multiple Node.js versions without relying on package managers like apt or yum, which often lag behind releases.

It supports both stable, LTS, and nightly builds, handling architecture detection (x64, arm64) automatically. Installation is non-root by default, placing Node.js in ~/.nodeversions or a custom path. After installation, it provides commands to switch versions via symlinks or shell integration.

Unlike full version managers like NVM, it focuses on simplicity for single-version installs but can be scripted for multi-version setups. It verifies checksums for security and cleans up previous installs if specified.

CAVEATS

Requires curl or wget; not available in standard repos—install via pip or git clone. May conflict with system Node.js packages. Use --dir=/opt for shared installs but requires sudo.

EXAMPLES

install-nodeversion 18.17.0
Installs Node.js v18.17.0 to default dir.

install-nodeversion --lts --dir=/usr/local
Installs LTS to /usr/local (sudo needed).

install-nodeversion --current -y
Auto-installs latest stable.

VERSION FORMAT

Supports formats: v18.17.0, 18.17.0, 18.x (latest minor), or aliases like fermium.

HISTORY

Introduced in 2020 as part of the NodeSource toolchain for streamlined distro-agnostic installs. Evolved from earlier scripts in Node.js Docker images; version 1.0 coincided with Node 14 LTS.

SEE ALSO

node(1), npm(1), nvm(1), n(1)

Copied to clipboard