Volta

Javascript command-line tool manager

Official Guide

Table of contents
  1. Why Volta?
  2. Installation
    1. Using Homebrew
    2. Using installation script
  3. Usage example
    1. Install
  4. curl SSL certificate problem
    1. Workaround (Not Recommended)
    2. Fix

Why Volta?

If you’ve ever tried uninstalling Node or installing a newer version of Node for a project, you may have found that it can get quite ugly.

Volta keeps all of the binaries in your home directory, and makes it easy to install and uninstall different versions.

You can also use Volta to pin a specified Node version for each project, much like the Python virtual environments.


Installation

Using Homebrew

brew install volta

Add to ~/.zshrc:

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"

Using installation script

curl https://get.volta.sh | bash

Necessary PATH will be added to .zshrc.

If you get a curl: (60) SSL certificate problem: certificate has expired error, you may be using an old version of OpenSSL or LibreSSL. Workaround/Fix


Usage example

Install

volta install node
volta install yarn

curl SSL certificate problem


This is a known issue (as of Sep. 2021).

The issue is not due to Volta but is related to an older version of OpenSSL/LibreSSL.

See here for details, but long story short:

  • Update to OpenSSL 1.1 for secure connection using LetsEncrypt certificates.

As suggested by this comment, one hacky workaround is to just use an insecure (-k) curl:

curl -k https://get.volta.sh > volta.sh

Then change line 10 of volta.sh to use an insecure curl as well:

 9|  get_latest_release() {
10|    curl -k --silent "https://volta.sh/latest-version"  
11|  }

Then run:

bash volta.sh

It works, but defeats the whole purpose of certificates.

Fix

Better approach is to install the brew packaged curl, as it uses OpenSSL 1.1 while the shipped curl uses an older version of LibreSSL.