LinuxCommandLibrary

volta

Manage Node.js and npm versions

TLDR

List all installed tools

$ volta list
copy

Install the latest version of a tool
$ volta install [node|npm|yarn|package_name]
copy

Install a specific version of a tool
$ volta install [node|npm|yarn]@version
copy

Choose a tool version for a project (will store it in package.json)
$ volta pin [node|npm|yarn]@version
copy

Display help
$ volta help
copy

Display help for a subcommand
$ volta help [fetch|install|uninstall|pin|list|completions|which|setup|run|help]
copy

SYNOPSIS

volta [command] [options]
volta install [tool-name][@version]
volta pin [tool-name][@version]
volta uninstall [tool-name]
volta list [tool-name]
volta current
volta completions
volta setup
volta run <command> [args...]
volta --version
volta --help

PARAMETERS

install
    Installs a specific tool (Node.js, npm, Yarn, pnpm) or a specific version of it globally.
Example: volta install node@18.17.0

pin
    Pins a specific tool version to the current project. This writes the version into package.json.
Example: volta pin node@18

uninstall
    Uninstalls a specific tool or version.
Example: volta uninstall node@16

list
    Lists installed tool versions or specific tool details.
Example: volta list all

current
    Shows the currently active Node.js, npm, Yarn, and pnpm versions.

setup
    Sets up Volta for the first time, configuring shell PATH and necessary environment variables.

run
    Executes a command with a specific toolchain without changing the project's pinned versions. Useful for testing.
Example: volta run node@16 myscript.js

--version
    Displays the installed Volta version.

--help
    Displays help information for Volta or a specific subcommand.
Example: volta pin --help

DESCRIPTION

Volta is a powerful and reliable JavaScript toolchain manager designed to simplify the management of Node.js, npm, Yarn, and pnpm versions across different projects.
Unlike other version managers, Volta focuses on speed and seamless integration, automatically detecting and using the correct tool versions based on your current project's configuration (typically defined in package.json). This eliminates common "works on my machine" issues and ensures consistent development environments.
Volta installs tools globally once and then creates lightweight shims, making it incredibly fast. It supports declarative configuration, allowing teams to specify required tool versions directly in their project's package.json file, ensuring everyone uses the same setup.

CAVEATS

Volta is primarily designed for JavaScript toolchain management (Node.js, npm, Yarn, pnpm) and does not manage other programming languages or system-level packages.
Requires proper shell configuration (PATH modification) for automatic version switching to work effectively.
Its automatic version switching relies on package.json entries; projects without these will default to global Volta settings or system installations.

PROJECT-BASED TOOLING

One of Volta's core strengths is its ability to automatically switch Node.js, npm, Yarn, and pnpm versions based on the project you are working in. By specifying tool versions in your project's package.json file (e.g., "volta": { "node": "18.x", "npm": "9.x" }), Volta ensures that everyone on a team uses the exact same toolchain, eliminating "it works on my machine" issues and simplifying onboarding for new developers.

OFFLINE SUPPORT

Once a tool version is installed with Volta, it is cached locally. This means that subsequent uses of that version, even in new projects, do not require a network connection, making development more efficient and reliable in environments with intermittent internet access.

HISTORY

Volta was created by Microsoft and first open-sourced in 2018. It was developed to address common frustrations with JavaScript toolchain management, such as slow installation times, inconsistent environments across developer machines, and difficulties in switching between project-specific Node.js versions. Its design emphasizes speed through global caching of tool versions and reliability through deterministic project configuration via package.json. It quickly gained traction in the Node.js community as a robust alternative to existing version managers.

SEE ALSO

nvm(1): Node Version Manager, n(1): Node version management, fnm(1): Fast Node Manager, asdf(1): Extendable version manager, supports Node.js via plugin, npm(1): Node Package Manager, yarn(1): Fast, reliable, and secure dependency management, pnpm(1): Fast, disk space efficient package manager

Copied to clipboard