Skip to content

Managing Your Project

Volta allows teams and collaborators to standardize on the development tools they use for their projects. This guide will show you how to effectively manage your projects with Volta.

Pinning Tool Versions

The most important project management feature in Volta is the ability to pin specific tool versions to your project:

Pinning Node.js

To specify which Node.js version your project should use:

bash
volta pin node@16.14.2

You can also pin to a major or minor version, and Volta will use the latest matching version:

bash
volta pin node@16

Pinning Package Managers

Similarly, you can pin npm and Yarn versions:

bash
volta pin npm@8.5.0
volta pin yarn@1.22.18

How Pinning Works

When you pin a tool version, Volta:

  1. Updates your project's package.json file with a volta section
  2. Commits this information to version control
  3. Ensures everyone on your team uses the same versions

Here's what the volta section looks like in your package.json:

json
{
  "name": "your-project",
  "version": "1.0.0",
  "volta": {
    "node": "16.14.2",
    "npm": "8.5.0",
    "yarn": "1.22.18"
  }
}

Project-local Tools

Volta also respects project-local tool installations:

Using Local Package Binaries

When you install packages locally in your project:

bash
npm install typescript
# or
yarn add typescript

You can run their binaries through Volta:

bash
volta run tsc
# or simply
tsc

Volta will use the project's pinned Node.js version to run these tools.

Workspaces Support

For monorepo setups with multiple projects, Volta supports configuration inheritance:

Extending Configurations

In a workspace with multiple projects, you can set up a base configuration in the root package.json:

json
{
  "volta": {
    "node": "16.14.2",
    "yarn": "1.22.18"
  }
}

Then in individual project package.json files, extend the root configuration:

json
{
  "volta": {
    "extends": "../../package.json"
  }
}

This allows you to maintain consistent tool versions across all projects in your workspace.

Best Practices for Project Management

Here are some recommended practices for managing projects with Volta:

1. Always Pin Your Tools

Pin Node.js and package manager versions for every project:

bash
volta pin node
volta pin npm
# or
volta pin yarn

This ensures consistent development environments for all team members.

2. Commit the Volta Configuration

Always commit the volta section in your package.json to version control. This is how Volta shares configuration with your team.

3. Document Tool Requirements

In your project's README, mention that you use Volta for tool management:

markdown
## Development

This project uses [Volta](https://volta.sh) to ensure consistent tooling.
Install Volta, and the correct versions of Node.js and npm will be automatically used.

4. Use CI/CD Integration

In continuous integration environments, install Volta as part of your build process:

bash
# Example for GitHub Actions
- name: Install Volta
  uses: volta-cli/action@v1

# Volta will automatically use the correct Node.js and npm/yarn versions
- name: Install dependencies
  run: npm install

5. Standardize Across Projects

For organizations with multiple projects, standardize on tool versions when possible to minimize the number of versions developers need to install.

By effectively managing your projects with Volta, you ensure that all team members have consistent development environments, reducing "works on my machine" problems and making collaboration smoother.

Released under the BSD 2-Clause License.