Skip to content

Managing Your Toolchain

Volta's job is to manage your JavaScript command-line tools, such as node, npm, yarn, or executables shipped as part of JavaScript packages. This guide will show you how to effectively manage your toolchain with Volta.

Setting Default Tools

When you're not in a project directory, Volta uses your default tools. Setting these defaults is simple:

Installing Node.js

To install a specific version of Node.js as your default:

bash
volta install node@16.14.2

You can also specify a major or minor version, and Volta will choose the latest matching version:

bash
volta install node@16

Or simply install the latest LTS (Long-Term Support) version:

bash
volta install node

Installing Package Managers

Similarly, you can set default versions of npm and Yarn:

bash
volta install npm@8.5.0
volta install yarn@1.22.18

Or install the latest versions:

bash
volta install npm
volta install yarn

Managing Multiple Versions

Volta makes it easy to have multiple versions of tools installed simultaneously:

Listing Installed Tools

To see all the tools in your toolchain:

bash
volta list all

You can also list specific tool types:

bash
volta list node
volta list npm
volta list yarn
volta list packages

Uninstalling Tools

If you no longer need a tool, you can uninstall it:

bash
volta uninstall node
volta uninstall npm
volta uninstall yarn
volta uninstall package-name

Note that uninstalling Node doesn't remove it from Volta's cache, so projects that use that version will still work.

Working with Global Packages

One of Volta's most powerful features is its handling of global packages:

Installing Global Packages

Install packages globally using your package manager as usual:

bash
npm install --global typescript
# or
yarn global add typescript

Volta will ensure these packages always use the right version of Node.js.

Finding Package Locations

To see where a tool is actually installed:

bash
volta which node
volta which npm
volta which typescript

Advanced Tool Management

For more advanced use cases, Volta offers additional commands:

Fetching Without Installing

To download a tool to your local cache without setting it as default:

bash
volta fetch node@14.17.0
volta fetch npm@7.20.3

This is useful for preparing your environment for offline work.

Running with Custom Versions

To temporarily run a command with specific tool versions:

bash
volta run --node 14.17.0 --npm 7.20.3 node app.js

This doesn't change your defaults or project settings.

Best Practices

Here are some recommended practices for managing your toolchain:

  1. Set sensible defaults: Install stable LTS versions as your defaults
  2. Install tools globally: Take advantage of Volta's smart handling of global packages
  3. Keep your toolchain lean: Uninstall tools you no longer need
  4. Use volta fetch: Prepare for offline work by fetching tools in advance
  5. Explore with volta run: Test different versions without changing your defaults

By effectively managing your toolchain with Volta, you can ensure a smooth and consistent development experience across all your JavaScript projects.

Released under the BSD 2-Clause License.