Installation | Yarn (original) (raw)

  1. Install Corepack, an intermediary tool that will let you configure your package manager version on a per-project basis:
  2. Then initialize a new project:

yarn init -2

Updating Yarn

Any time you'll want to update Yarn to the latest version, just run:


yarn set version stable

yarn install

Yarn will then configure your project to use the most recent stable binary.

tip

Yarn also frequently ships Release Candidate builds. Use yarn [set version](/cli/set/version) canary should you need a feature not released on the stable channel yet. Those builds are very stable, the only difference with the regular channel being a more staggered migration between major as we implement new breaking changes.

Installing the latest build fresh from master

You may want to test a version of Yarn so recent it hasn't been released in a Release Candidate yet, or even not merged. The following command will clone, build, and install Yarn in your project, straight from our repository:


yarn set version from sources

It accepts a --branch flag which you can use to test specific PRs:


yarn set version from sources --branch 1211

warning

Unlike the stable and canary channels, the yarn [set version from sources](/cli/set/version/from/sources) command can't leverage Corepack and will need to store the Yarn binary inside the .yarn/releases folder and reference it from your project's .yarnrc.yml file.