Package Binaries
Details about the process of installing package binaries.
Customizing Download Locations
Internally, volta install <tool>
uses npm-style resolution to determine which versions are available and the download location for package binaries. Accordingly, to redirect and use an internal repository (i.e. to install an internal tool from a private repo), you can create a .npmrc
file in your home directory. Options specified there will be honored when resolving and downloading a tool, as well as when resolving the dependencies of a given tool.
Pinned Node Version
As described in Understanding Volta, Volta will pin a version of Node when a tool is installed, so that the tool can continue to be used, even if the default Node version changes. The process used to determine which version should be pinned is as follows:
Prior to Volta 0.6.8
- If the package has
engines
specified inpackage.json
, use the latest version of Node that meets the requirements inengines
- Otherwise, use the most recent version of Node
Volta 0.6.8 through Volta 0.8.7
- If the package has
engines
specified inpackage.json
, use the latest LTS version of Node that meets the requirements - If no LTS versions meet the requirements then use the latest overall version that satisfies
engines
- If
engines
isn't available, use the most recent LTS version of Node
Volta 0.9.0 and beyond
Starting with Volta 0.9.0, Volta will pin a package to your current default Node version (at the time the tool was installed). You can change that version by changing your default, or by running the install with volta run
:
volta run --node 15 npm i -g ember-cli
Global Package Management
When you install a global package using Volta, it creates a shim in your Volta bin directory that points to the specific version of the package you installed. This allows you to:
- Use the package from anywhere on your system
- Ensure the package always runs with the Node version it was installed with
- Install multiple global packages that require different Node versions
Using npm or Yarn for Global Packages
As of Volta 0.9.0, you can use standard npm or Yarn commands to manage global packages:
# Install a global package with npm
npm install -g typescript
# Install a global package with Yarn
yarn global add eslint
# Uninstall a global package with npm
npm uninstall -g typescript
# Uninstall a global package with Yarn
yarn global remove eslint
Volta intercepts these commands and ensures that the packages are properly installed in the Volta ecosystem, creating the necessary shims.
Checking Installed Packages
To see which global packages are currently installed, use:
volta list packages
Package Binary Resolution
When you run a package binary (like tsc
for TypeScript), Volta follows these steps:
- Check if the binary is in a project with a local installation of the package
- If found locally, use that version
- If not found locally, use the globally installed version
- If not installed globally, show an error message
This resolution process ensures that you always use the correct version of a tool for each project.