yarn "Couldn't find package … required by …" - Fix Resolution in CI
This yarn error means a required package (or a specific version of it) is not available from the registry yarn is using - a missing version, a private package without auth, or a wrong registry.
What this error means
yarn install fails with "Couldn't find package <name>@<range> required by <parent>", or "Couldn't find any versions for <name>". Yarn asked the registry and got nothing usable for that requirement.
error Couldn't find package "@acme/internal@^2.0.0" required by "app@1.0.0"
on the "npm" registry.
# or:
error Couldn't find any versions for "left-pad" that match "^9.9.9"Common causes
The version/range does not exist
A typo or over-eager pin requests a version the registry never published, so yarn finds no match.
Private package without registry/auth config
A private/scoped package needs a registry mapping and token in .yarnrc/.npmrc. Without them yarn looks on the public registry and finds nothing.
Wrong or stale registry
A misconfigured registry, or a mirror that has not synced the version, can make an existing package look absent.
How to fix it
Fix the version or the registry/auth
Point yarn at the right registry with credentials, or correct the requested range.
# scoped private registry + token (.yarnrc.yml, Yarn Berry)
npmScopes:
acme:
npmRegistryServer: "https://npm.pkg.github.com"
npmAuthToken: "${NODE_AUTH_TOKEN}"Confirm the package exists as requested
- Check the published versions (
yarn npm info <pkg>on Berry, or via the registry). - Correct any typo in the scope, name, or range.
- For private packages, ensure the scope→registry mapping and token are present in CI.
How to prevent it
- Map private scopes to their registry with a CI token.
- Pin to ranges that exist; let tooling propose upgrades.
- Keep registry/mirror config consistent across environments.