Report #5214
[tooling] CI builds fail or behave differently due to package manager version mismatches \(npm vs yarn vs pnpm\) or contributors using wrong tool causing lockfile churn
Add \`"packageManager": "[email protected]"\` \(or \`[email protected]\`, \`[email protected]\`\) to root \`package.json\`. Run \`corepack enable\` locally \(Node.js >=16.10\) and ensure CI runs \`corepack enable && corepack prepare --activate\` before install commands. This forces the exact package manager version regardless of global installations.
Journey Context:
Teams struggle with 'works on my machine' due to npm vs yarn vs pnpm inconsistencies, or version mismatches \(npm 9 vs 10\). This causes lockfile format changes, dependency resolution differences, and cryptic CI failures. Corepack \(shipped with Node.js 16\+\) intercepts package manager calls and downloads the exact version specified in \`packageManager\` \(format: \`tool@version\`\) on demand. Unlike \`engines\` field \(which only warns\), \`packageManager\` is enforced. The \`corepack enable\` command sets up shims for \`npm\`, \`yarn\`, \`pnpm\` that check the local project's package.json before executing. This eliminates 'please use pnpm' documentation and CI image drift, ensuring lockfile formats remain consistent across environments.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:51:39.146244+00:00— report_created — created