Q:

How to install Yarn v1 and Yarn v2 on the same machine so they can be used interchangelby between projects? 

I'm running a couple of projects that make use of Yarn v1 that will not be upgraded to Yarn v2 anytime soon for many reasons (CI being one of them).  However, I would like to use Yarn v2 for new projects. 
Is there a sane way to have both Yarn v1 and Yarn v2 installed on one machine so they can be used interchangebly between projects? 

A:

We recommend using Yarn 1 as global, and using yarn policies set-version berry on a per-project basis (it will install Yarn 2 in .yarn/releases that you can then add to your repository).  This keeps the risks to a minimum and allows you to migrate when you feel ready. 
Docs for yarn policies

