Yarn Berry ".yarnrc.yml" settings not applied in CI
Yarn Berry reads .yarnrc.yml, while Yarn classic (v1) reads .yarnrc and ignores the YAML file. If CI runs Yarn 1 by mistake, your Berry settings like nodeLinker silently have no effect.
What this error means
CI behaves as if .yarnrc.yml (nodeLinker, plugins, yarnPath) is ignored: a node_modules appears when you set PnP, or yarn --version prints a 1.x version.
$ yarn --version
1.22.22
# but .yarnrc.yml sets nodeLinker: pnp - it is ignored because Yarn 1 is runningCommon causes
Yarn classic is on PATH instead of Berry
The runner's global Yarn is 1.x and the project's Berry release was not activated, so .yarnrc.yml is ignored.
yarnPath / packageManager not honored
Corepack is not enabled and no committed .yarn/releases binary is referenced by yarnPath, so the wrong Yarn runs.
How to fix it
Activate Berry via corepack and packageManager
- Set
packageManagerto the Berry version inpackage.json. - Enable corepack before any yarn step.
- Confirm with
yarn --versionthat a 3.x/4.x runs.
- run: corepack enable
- run: yarn --version # expect 4.x
- run: yarn install --immutablePin the Berry release with yarnPath
Commit the Yarn release binary and reference it so the project always runs Berry regardless of the global Yarn.
yarnPath: .yarn/releases/yarn-4.5.0.cjs
nodeLinker: node-modulesHow to prevent it
- Pin the Yarn version via
packageManagerand enable corepack in CI. - Commit
.yarn/releasesand setyarnPathfor a hermetic Yarn. - Assert
yarn --versionearly so a classic Yarn is caught.