Yarn Version Manager (yvm)
Pesky yarn versions got you down? Automatically and easily manage those versions.
YVM will automatically use the correct yarn version when you run any yarn commands in any folder with a
.yvmrc or any other supported configuration file. Otherwise, it will use you a globally set version of yarn.
Manually managing different yarn versions across projects is a pain. This fixes that.
Installs the latest stable version.
brew install tophat/bar/yvm --without-node
NOTE: Remove the flag
--without-node to install with the node dependency.
Execute the following in your terminal:
curl -s https://raw.githubusercontent.com/tophat/yvm/master/scripts/install.js | node
Or to install a specific version:
curl -s https://raw.githubusercontent.com/tophat/yvm/v3.2.1/scripts/install.js | INSTALL_VERSION="v3.2.1" node
Some older versions of yvm do not have the node installer enabled. If so the shell script installer can be used.
curl -s https://raw.githubusercontent.com/tophat/yvm/v2.4.3/scripts/install.sh | INSTALL_VERSION="v2.4.3" bash
Navigate to yvm releases and download the
yvm.js file for the latest release into your desired yvm install directory.
.yvm your home directory, then run the following command to configure your shell.
node ./home/joe_user/.yvm/yvm.js configure-shell
You will need to reload the shell to get yvm, or source the generated
To upgrade yvm to the lastest version either install as normal, or run
Run any yarn command and watch it automagically use the correct version of yarn.
Yarn is shimmed to use the default version or the version defined your current directory config file.
To download and install a specific version of yarn, run:
yvm install <version>
To get the latest version of Yarn, run:
yvm install latest
Execute an arbitrary command using a specific version of yarn:
yvm exec <version> <command>
Switch the current yarn versions:
yvm use <version> yarn --version
NOTE: The above disables yarn shimming until a new shell is loaded.
Control version aliasing:
yvm alias stable # stable → 1.13.0 (1.13.0) yvm alias default stable # default → stable (1.13.0) yvm alias # default → stable (1.13.0) # latest → 1.14.0 (1.14.0) # stable → 1.13.0 (1.13.0) # system → 1.13.0 (1.13.0) yvm alias default '^1.7' # default → ^1.7 (1.14.0)
Show path to version used:
List installed yarn versions:
Full list of available commands:
Yvm defaults to using the
yarn version in your
engines. Otherwise you can create a
.yvmrc file containing the version number of yarn in your project's root directory. Afterwards,
yvm install and
yvm exec will use the version specified in the config file if no version number is supplied to the command.
You can also declare the version using other configuration files
yvm exec, the appropriate
yarn version is executed using the
node available in the current context. This can be explicitly specified using the
YVM_BOOTSTRAP_EXEC_PATH environment variable.
Example: if you are using
nvm, you can avoid having to execute
nvm use before using
export YVM_BOOTSTRAP_EXEC_PATH=~/.nvm/nvm-exec yvm exec my-command
You can set this environment variable globally in your preferred shell's setup script (e.g. bashrc/zshrc).
The script referenced via the exec path must be executable. It receives the yarn executable as its first argument, and should forward the remaining arguments to yarn.
A full list of commands is on the api reference page
Have questions? List of common questions and answers
To remove yvm simply execute
rm -rf $YVM_DIR
$HOME/.zshrc and remove those lines:
export YVM_DIR=/home/joe_user/.yvm [ -r $YVM_DIR/yvm.sh ] && . $YVM_DIR/yvm.sh
$HOME/.config/fish/config.fish for fishers:
set -x YVM_DIR /home/joe_user/.yvm [ -r $YVM_DIR/yvm.fish ]; and source $YVM_DIR/yvm.fish
In case you had older version of yvm installed, there could also be a line like
or those lines could be in
$HOME/.bash_profile instead of
We welcome contributions from the community, Top Hatters and non-Top Hatters alike. Here are some guidelines to help you get started!
Basic development flow
- Ensure the problem you are solving is an issue or you've created one
- Clone the repo
- We use make.
make helpwill show you a list of development commands
make install-watchwill install yvm on your shell and update when you make changes. Make sure to only run this in the root yvm directory, it will fail elsewhere.
make lintare also commonly helpful
Make sure all changes are well documented. Our documentation can be found inside the
docs section of this repo. Be sure to read it carefully and make modifications wherever necessary.
You can also access the documentation on our website
Please make sure to look over our Code of Conduct as well!
Manual testing command contributions
make install yvm <your-command-here>
Technologies to Familiarize Yourself with
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Thanks to Carol Skelly for donating the github organization!