Yarn Version Manager

Top Hat Engineering
Top Hat Engineering Blog
2 min readNov 27, 2018

--

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.

--

--