yarn --frozen-lockfile Outdated in CI - Fix Lockfile Out of Sync
yarn install --frozen-lockfile (Yarn Classic) fails if installing would change yarn.lock. In CI that guards reproducibility, so the error means your lockfile does not match package.json.
What this error means
The CI install step fails saying your lockfile needs to be updated but --frozen-lockfile prevented this. Locally yarn install succeeds because it is allowed to write yarn.lock.
yarn
error Your lockfile needs to be updated, but yarn was run with
`--frozen-lockfile`.
error Found incompatibilities between package.json and yarn.lock.Common causes
package.json was changed without updating yarn.lock
A dependency edit landed without re-running yarn, so the committed lockfile no longer matches the manifest.
The lockfile was generated by a different yarn version
A different Yarn produced a lockfile shape CI does not accept as frozen.
How to fix it
Update and commit the lockfile
- Run yarn install locally to regenerate yarn.lock.
- Commit the updated lockfile so CI matches it.
Terminal
yarn install
git add yarn.lock
git commit -m "Update yarn.lock"How to prevent it
- Commit yarn.lock with every dependency change, pin the Yarn version, and keep --frozen-lockfile in CI so drift is caught before merge.
Related guides
yarn "Your lockfile needs to be updated" (--frozen-lockfile) - Fix in CIFix yarn "Your lockfile needs to be updated" under --frozen-lockfile / --immutable in CI - package.json chang…
pnpm ERR_PNPM_OUTDATED_LOCKFILE in CI - Fix Lockfile Out of SyncFix ERR_PNPM_OUTDATED_LOCKFILE in CI by regenerating and committing pnpm-lock.yaml, since pnpm install --froz…
npm ci "can only install with an existing package-lock.json" - Fix in CIFix "npm ci can only install with an existing package-lock.json" by committing a lockfile, since npm ci refus…