Tag Archives: yarn

Why Does Yarn 2 Work This Way?

One of the larger reasons using node modules can be a nightmare is the amount of time wasted installing/uninstalling/reinstalling modules on a per project basis using npm.

Facebook’s Yarn 2 uses a different methodology for installing modules that should provide significantly faster module management, so I figured I’d give it a try.

The install instructions say thus:

Installing Yarn 2.x globally is discouraged as we’re moving to a per-project install strategy.

Fine, this is the way a lot of development software does things these days. It continues:

We advise you to keep Yarn 1.x (Classic) as your global binary by installing it via the instructions you can find here.

Wait a second, what? We are installing a legacy software application to manage our current application? If we are going to do this why not just use Yarn 2.x globally?

Unfortunately there is no explanation (nor link to an explanation) and I was not able to quickly surface (via a Google search) why this should be.

I assume that:

  1. Having Yarn 2.x installed globally and on a per-project basis might cause problems (or simply not work at all).
  2. Eventually Yarn 2.x will be installable on a per-project basis without the necessity for a global package manager.

Can anyone shed some light on why exactly this is the recommended route?