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 install [node@version | npm@version | package-name@version]
volta use [node@version | npm@version | package-name@version]
volta list
volta pin [node@version | npm@version | package-name@version]
volta completions [bash|fish|powershell|zsh]
volta uninstall [node | npm | package-name]
volta help [command]

PARAMETERS

install
    Installs a specific version of Node.js, npm, or a package globally.

use
    Specifies the Node.js and npm versions to use for the current project, without pinning to package.json.

list
    Lists installed Node.js and npm versions.

pin
    Pins the specified Node.js and npm versions to the project's package.json file (or creates .volta/toolchains/node/VERSION/package.json if necessary) so that those versions are automatically selected.

completions
    Prints shell completion script.

uninstall
    Uninstalls a previously installed version of Node.js, npm, or a package.

help
    Displays help information for a specific command.

node@version
    Specifies a Node.js version (e.g., node@16, node@14.17.0).

npm@version
    Specifies an npm version (e.g., npm@8, npm@7.20.0).

package-name@version
    Specifies a package version to install (e.g., yarn@latest).

DESCRIPTION

Volta is a command-line tool designed to simplify the management of Node.js and npm versions.
It allows you to pin specific Node.js and npm versions to your projects, ensuring consistency across development environments.
Volta automatically switches to the required versions when you navigate into a project directory that specifies them in its configuration.
Unlike some other version managers, Volta does not rely on shims or modifying the PATH variable in a global and disruptive way. Instead, it uses a proxy approach, making it faster and more reliable.
This approach avoids conflicts with globally installed packages and makes it easier to manage dependencies. Volta is particularly useful in collaborative projects where different developers might have different Node.js versions installed on their machines.
By using Volta, you can ensure that everyone is using the same versions, preventing compatibility issues and streamlining the development process.

CAVEATS

Volta manages Node.js and npm versions on a per-project basis, requiring the user to 'pin' versions in the project directory or use 'use' command which only sets for active shell.
It might not be compatible with all existing Node.js development workflows, especially those that heavily rely on global installations or specific PATH configurations.

SHADOWING

Volta can shadow executables that are located in directories added to your PATH environment variable, meaning that if you run a command, Volta might intercept it and run the command through one of the executables it installs.

TOOLCHAINS

Volta stores installed tools in separate folders, one for each version. Tools installed this way are called 'toolchains'. This way Volta can use different versions of the same tool safely. Also, volta is able to install versions of yarn as it does for node and npm.

HISTORY

Volta was created to address the challenges of managing Node.js versions across different projects and development environments. It aims to provide a more reliable and consistent approach compared to older version managers by avoiding shims and directly managing toolchains.
Its development focused on performance, ease of use, and integration with existing Node.js workflows.

SEE ALSO

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

Copied to clipboard