Skip to content

teambit/bvm

Repository files navigation

BVM is a version manager for Bit.
Using BVM makes it easier to install and manage multiple versions of Bit in a single environment.

Features

  • Consistent installation: All Bit dependencies are bundled together to ensure a consistent and predictable package installation that is not affected by SemVer rules.
  • Fast installation: A simple and quick installation process that requires no additional time-consuming operations (post-install scripts, etc.)
  • Friendly UX: Easy upgrades and version management
  • Multiple Bit versions: Easily switch between Bit versions or even use multiple versions in parallel

Install BVM

Install with NPM

npm i -g @teambit/bvm

Install with pnpm

pnpm add -g @teambit/bvm

Install with Yarn

yarn global add @teambit/bvm

Install Bit

Install Bit's latest version

bvm install

Install A specific Bit version

bvm install <bit-version>

Upgrade to Bit's latest version

Install the latest version and remove the version previously used.

bvm upgrade

Manage versions

Get the current version of BVM

bvm -v

List all versions of Bit available to be installed

bvm list --remote

Switch to another bit version

Switch the currently used bit version

bvm use <bit-version>

Get the local and remote versions of Bit and BVM

Get the local used versions, local latest versions and remote latest versions of Bit and BVM

bvm version

List all installed Bit versions

bvm list

Remove an installed Bit version

bvm remove <bit-version>

Link to a specific Bit version

Link a command name to a Bit version (link to binaries in the PATH variable).

bvm link <command> <bit-version>

For example, the following line will link Bit's version 0.0.315 to the bitty command name (this will execute Bit's version 0.0.315 whenever the bitty command is used).

bvm link bitty 0.0.315

Validate the link by checking the version number of the new link:

$ bitty -v

0.0.315 (@teambit/legacy: 1.0.28)

:::info Auto-Link Bit's latest version to bbit If a legacy version of Bit (Bit v14) is installed on your machine, BVM will automatically link the latest version to bbit (instead of bit) to allow you to use both versions in parallel. :::

BVM configurations

Change BVM dir via environment variable

Make sure to set an env variable named BVM_GLOBALS_DIR. Bvm will create its config in this folder, and will set the BVM_DIR inside the config to this folder as well.

Get BVM configurations

  • DEFAULT_LINK - The default command name to be linked to BVM's latest version.
    bit is linked by default unless a legacy version of Bit is installed. In that case, bbit will be linked, instead.

  • BVM_DIR - The location for BVM (this will no apply for the config of bvm itself, as it's configured inside the config) In order to change the entire folder include config, use the BVM_GLOBALS_DIR env variable described above.

bvm config

Set BVM configurations

bvm config set <property> <new-value>

For example, to change the default link for Bit, from bit to bitty:

bvm config set DEFAULT_LINK bitty

Troubleshooting

The PATH env variable is missing BVM's installation directory

MacOS / Linux

The error message:

global Bit install location was not found in your PATH global variable.
please add the following command to your bash/zsh profile then re-open the terminal:
export PATH=$HOME/bin:$PATH

Solution:

Bash

Run the following command:

echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc && source ~/.bashrc
ZSH (Z Shell)

Run the following command:

echo 'export PATH=$HOME/bin:$PATH' >> ~/.zshrc && source ~/.zshrc
Windows

The error message:

global Bit install location was not found in your PATH global variable.
please run the following command and then re-open the terminal:
setx path "%path%;C:\Users\USER\AppData\Local\.bvm" and re-open your terminal

Solution:

Run the following command:

setx path "%path%;%LocalAppData%\.bvm"

If you're running VSCODE - restart it (learn why here).

License 💮

Apache License, Version 2.0