This document explains how to manage the repository-pinned Yarn version.
Table of Contents ᐞ
Overview ᐞ
This project pins Yarn in-repo so development, CI, and Docker use the same version.
Pinned Yarn is defined by:
package.jsonfieldpackageManager.yarnrc.ymlfieldyarnPath- checked-in release file in
.yarn/releases/
Check Current State ᐞ
make yarn-statusThis prints:
- configured Yarn version
- active Yarn version
- latest stable Yarn Berry version
- update availability status
Dry-run check with no file changes:
make yarn-upgrade-checkUpgrade Yarn ᐞ
Use explicit version:
make yarn-upgrade VERSION=4.17.0Use compatible alias:
make yarn upgrade VERSION=4.17.0Use latest stable automatically:
make yarn-upgradeWhat Changes on Upgrade ᐞ
Expected changed files:
package.json.yarnrc.yml.yarn/releases/yarn-<version>.cjs
Implementation Details ᐞ
Make targets call these scripts:
scripts/yarn-lib.shscripts/yarn-status.shscripts/yarn-upgrade.shscripts/yarn-upgrade-check.sh
Upgrade flow:
- update
packageManagerinpackage.json - run
yarn set versionto update.yarnrc.ymland release file - run
corepack prepare yarn@<version> --activate
Manual Commands ᐞ
npm pkg set packageManager="yarn@4.17.0"
yarn set version "4.17.0"
corepack prepare "yarn@4.17.0" --activate
Troubleshooting ᐞ
Latest Stable Cannot Be Resolved ᐞ
If latest lookup fails, use an explicit version:
make yarn-upgrade VERSION=4.17.0Version Mismatch ᐞ
If configured and active differ, run:
make yarn-upgrade
make yarn-statusConfirm Project Pin ᐞ
node -p "require('./package.json').packageManager"
grep "yarnPath:" .yarnrc.yml
ls -1 .yarn/releases/Related Docs ᐞ
doc/YARN_UPDATE_QUICK_REF.mddoc/YARN_UPDATE_SETUP.mddoc/README.md