Skip to content
Latchkey

Composer "Your requirements could not be resolved" - Fix Dependency Conflicts

Composer’s dependency solver could not find a single set of versions that satisfies every constraint in composer.json at once. Two packages - or a package and your PHP/extension constraints - demand mutually exclusive versions.

What this error means

composer install or composer update runs the solver, then aborts with "Your requirements could not be resolved to an installable set of packages", listing the conflicting constraints. It is deterministic and reproduces locally with the same composer.json.

composer output
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires symfony/console ^7.0 but it conflicts with
      another require.
    - laravel/framework v10.0.0 requires symfony/console ^6.2 -> found
      symfony/console[v6.2.0, ...] but it conflicts with your root requirement.

Common causes

Two packages pin incompatible shared versions

Package A requires symfony/console ^7 while package B requires ^6. No single version satisfies both, so the solver gives up.

An over-tight constraint in your own composer.json

A hard version constraint you added conflicts with what a dependency requires. Loosening it to a compatible caret range often resolves the set.

How to fix it

Read the conflict and align a constraint

  1. Identify the shared package and the two conflicting constraints in "Problem 1".
  2. Loosen your own constraint to a range that overlaps both, if one exists.
  3. If two third-party packages conflict, upgrade the lagging one to a release that accepts the newer shared dependency.

Let Composer explain the conflict in detail

Re-run with full verbosity, or ask why a package is constrained.

Terminal
composer update -vvv
composer why-not symfony/console 7.0

Install from the lockfile in CI

CI should install the already-resolved set rather than re-solving from scratch.

Terminal
composer install --no-interaction --prefer-dist

How to prevent it

  • Commit composer.lock and run composer install (not update) in CI.
  • Use caret ranges (^) rather than hard pins unless a hard pin is genuinely required.
  • Upgrade related packages together so shared dependencies stay compatible.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →