Yarn Version Manager

How do you currently manage your Yarn versions across different files? If you are like most people, the answer is probably along the lines of “painfully and not efficiently”.

There are version managers for Python, Node and Ruby. Why is there no love for Yarn?

The answer is Yarn is actually getting some love, from Yarn Version Manager, aka YVM.

Why you need it

Uhh, self explanatory really. Manage your Yarn versions easily and automatically?

Managing different versions of Yarn was a nightmare before. You would have to uninstall Yarn, and globally reinstall the version you wanted to use now. It’s complicated and it shouldn’t be.

YVM allows you to have as many versions of Yarn installed as you would like, and you can seamlessly switch between them automatically, or by using a simple command.

How it Works

Managing Yarn is actually super easy using YVM. Once it is installed, you simply type in a Yarn command and it will automatically use the correct version of Yarn using the specified version in your .yvmrc file. Magically and automatically. What more can you ask for?

If you do not have a .yvmrc file in your directory, it will use a preset global default version of Yarn.

I want more control

So you are having a power trip and want more control over what is going on. No problem, YVM has you covered too.

The API has a variety of useful commands you can run.

When specifying versions. Be sure to include the full version. 1.7.0 is good. 1.7 is not good. Do not add a v in front of the version number (ie v1.7.0).

Want to use a different version of Yarn? Use the command `yvm use <version_number>`.

Want to install another version of Yarn? Use the command `yvm install <version_number>`.

Want a list of installed Yarn versions? Use the command `yvm list`.

Summary

Once installed, you don’t really have to do much thinking about managing Yarn versions. Install the versions of Yarn you need using YVM, then simply switch to a directory with a `.yvmrc` file and any Yarn command run from then on will automatically use the correct Yarn version!

Install YVM. Thank me later.

Top Hat Engineering Blog

All things Engineering @ Top Hat

Top Hat Engineering

Written by

Editor of the Top Hat Engineering Blog medium.com/top-hat-engineering

Top Hat Engineering Blog

All things Engineering @ Top Hat

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade