Skip to content
Latchkey

Composer "Could not find a matching version of package X" in CI

Composer searched every configured repository for the package (and version) you asked for and found nothing that matches. The package may be misspelled, private, or pinned to a version that does not exist.

What this error means

composer require or composer install fails with "Could not find a matching version of package <name>" or "The requested package <name> could not be found in any version", sometimes noting a minimum-stability issue.

composer
[InvalidArgumentException]
Could not find a matching version of package acme/widget. Check the
package spelling, your version constraint and that the package is
available in a stability which matches your minimum-stability (stable).

Diagnose it: platform requirements and auth

Composer resolves against the PHP version and extensions actually present, so a lockfile that installs locally can be unsatisfiable on a runner with a different PHP build.

Terminal
php -v && php -m | head -30
composer diagnose
composer check-platform-reqs

# install exactly what is locked, non-interactively
composer install --no-interaction --prefer-dist --no-progress

Common causes

The package name or version does not exist

A typo in the vendor/package name, or a version constraint that no published release satisfies, leaves Composer with nothing to match.

A private repository is not configured in CI

The package lives in a private VCS or Composer repository that is declared locally but missing from the CI environment.

minimum-stability excludes the only matching version

The package only has a dev/beta release while minimum-stability is stable, so Composer treats it as not found.

How to fix it

Verify the name, version, and stability

  1. Check the vendor/package spelling against Packagist or your private registry.
  2. Confirm a published version satisfies your constraint.
  3. If you need a non-stable release, set the right minimum-stability and prefer-stable, or add @dev to the constraint.

Configure the private repository in CI

Declare the repository and provide credentials without committing them.

composer.json + Terminal
# composer.json
"repositories": [
  { "type": "composer", "url": "https://repo.internal.example.com" }
]

# CI: supply the token at runtime
composer config --global --auth http-basic.repo.internal.example.com \
  token "${COMPOSER_REPO_TOKEN}"

How to prevent it

  • Declare every private repository in composer.json and configure its auth in CI.
  • Pin to published, stable versions and set minimum-stability intentionally.
  • Keep composer.lock committed so CI installs the exact versions you validated.

Frequently asked questions

What causes Composer "Could not find a matching version of package X" in CI?
There are 3 common causes: the package name or version does not exist, a private repository is not configured in ci, and minimum-stability excludes the only matching version. A typo in the vendor/package name, or a version constraint that no published release satisfies, leaves Composer with nothing to match.
How do I fix Composer "Could not find a matching version of package X" in CI?
There are 2 fixes depending on which cause you have: verify the name, version, and stability and configure the private repository in ci. Work through them in order, since the first is the most common.
What does Composer "Could not find a matching version of package X" in CI actually mean?
composer require or composer install fails with "Could not find a matching version of package <name>" or "The requested package <name> could not be found in any version", sometimes noting a minimum-stability issue.
How do I stop Composer "Could not find a matching version of package X" in CI happening again?
Declare every private repository in composer.json and configure its auth in CI. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card