CLI Commands
Volta provides a rich set of command-line commands to help you manage your JavaScript toolchain.
Core Commands
volta install
Installs a tool in your toolchain.
bash
# Install latest Node.js LTS
volta install node
# Install specific version of Node.js
volta install node@16.14.2
# Install latest npm
volta install npm
# Install specific version of yarn
volta install yarn@1.22.19
# Install a package globally
volta install typescript
volta install @vue/cli
Options:
--verbose
: Enables verbose diagnostics--quiet
: Prevents unnecessary output
volta uninstall
Uninstalls a tool from your toolchain.
bash
# Uninstall Node.js
volta uninstall node
# Uninstall npm
volta uninstall npm
# Uninstall a package
volta uninstall typescript
volta pin
Pins a tool to your project's package.json
.
bash
# Pin Node.js
volta pin node@16.14.2
# Pin npm
volta pin npm@8.5.0
volta list
Lists the tools available in your toolchain.
bash
# List all tools
volta list all
# List installed Node.js versions
volta list node
# List installed package managers
volta list npm
volta list yarn
# List installed packages
volta list packages
volta which
Shows the path to the specified tool that Volta would use.
bash
volta which node
volta which npm
volta which typescript
volta run
Runs a command with custom tool versions.
bash
# Run with specific Node.js version
volta run --node 14 node index.js
# Run with specific npm version
volta run --npm 6 npm install
# Run with both custom Node.js and npm
volta run --node 14 --npm 6 npm install
Additional Commands
volta completions
Generates shell completion scripts.
bash
# Generate bash completions
volta completions bash > volta.bash
# Generate zsh completions
volta completions zsh > _volta
# Generate fish completions
volta completions fish > volta.fish
volta setup
Configures Volta in your environment.
bash
# Set up Volta with default settings
volta setup
# Set up volta without modifying profiles
VOLTA_SKIP_SETUP=1 volta setup
volta help
Shows help for Volta commands.
bash
# General help
volta help
# Help for specific command
volta help install
volta help pin
Exit Codes
Volta commands return the following exit codes:
0
: Success1
: Generic error2
: Command-line argument error- Higher numbers: Command-specific errors
Environment Variables
These environment variables affect Volta's behavior when running commands:
VOLTA_HOME
: Directory where Volta will store its dataVOLTA_LOGLEVEL
: Verbosity of logs (error, warn, info, verbose, debug)VOLTA_SKIP_SETUP
: Skip modifying shell profile during setupVOLTA_FEATURE_PNPM
: Enable pnpm support