yarn "Couldn't find any versions for <pkg> that match <range>" - Fix in CI
This yarn error is the version-resolution failure: yarn fetched the package but no published version satisfies the requested range. The range and the registry’s versions do not overlap.
What this error means
yarn install fails with "Couldn't find any versions for <pkg> that matches <range>". The package exists, but not at a version that satisfies what package.json/yarn.lock asks for.
error Couldn't find any versions for "left-pad" that matches "^9.9.9"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation.Common causes
The requested range was never published
A typo or over-eager pin targets versions that do not exist on the registry, so yarn finds nothing to match.
A stale or restricted registry/mirror
A mirror that has not synced a new publish, or a private registry that lacks the version, reports no matching version even when the canonical registry has it.
How to fix it
Check published versions and fix the range
List what exists and adjust the requested range.
yarn info left-pad versions
# then set a range that exists, e.g.
yarn add left-pad@^1.3.0Refresh the registry view
- If using a mirror, confirm it synced the version or fall back to the canonical registry.
- Clear the yarn cache if old metadata is cached.
- Regenerate
yarn.lockafter fixing the range.
How to prevent it
- Pin to ranges that exist; let tooling propose upgrades.
- Keep mirrors synced with the source registry.
- Commit
yarn.lockso ranges resolve consistently.