Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Composer cannot find a version that matches your minimum-stability

ErrorCould not find a version of package vendor/package matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.

Short answer

The package exists, but every release Composer can see is less stable than your minimum-stability setting, which is stable unless you changed it. Composer only raises this when you run require without a version. Give an explicit constraint with a stability flag, such as ^2.0@beta, or lower minimum-stability for the whole project.

  • Applies to Composer 2, PHP 8.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    List the versions Composer can see for the package and note what they are called: plain numbers are stable, names with alpha, beta or RC are pre-releases, and names starting with dev- are branches. Then read your project's own stability setting.

    composer show vendor/package
    grep -n -E "minimum-stability|prefer-stable" composer.json
  2. 2Match what you see, then jump to its fix

    1. 1composer show lists versions such as 2.0.0-beta.3 and no plain 2.x releaseThe package has only pre-release versions (alpha, beta or RC)Fix
    2. 2composer show lists only names like dev-main or dev-masterThe package has only branches and no tagged releaseFix
    3. 3The same error repeats for several packages in a row, and composer.json has no minimum-stability line or sets it to stableThe whole project needs pre-releases but its floor is still stableFix

What does the error look like?

  • Could not find a version of package vendor/package matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.
  • Could not find a version of package vendor/package matching your minimum-stability (RC). Require it with an explicit version constraint allowing its desired stability.

Cause 1 of 3

The package has only pre-release versions (alpha, beta or RC)

1Check

Composer ranks stability as dev, alpha, beta, RC, stable. With the default floor of stable, every pre-release is dropped from resolution, so a require with no version finds nothing it may install.

composer show vendor/package

2Fix

Name the version yourself and add a stability flag to it. The flag lets this one package be a beta while the rest of the project stays at stable.

composer require "vendor/package:^2.0@beta"

3Verify

composer.json now holds the constraint, and the package is installed.

grep -n "vendor/package" composer.json
composer show vendor/package

Confirmed by getcomposer.org

Did this fix it?

Cause 2 of 3

The package has only branches and no tagged release

1Check

A repository that never tagged a release offers branches only. Composer reads a branch as a version named dev- plus the branch name, and dev is the lowest stability.

composer show vendor/package

2Fix

Require the branch with the dev- prefix. Use the branch name your repository really has, and add the @dev flag to say you accept that stability. For a private Git repository, it must also be declared under repositories in composer.json.

composer require "vendor/package:dev-main@dev"

3Verify

composer.json now records the constraint, and composer show lists the package as installed.

grep -n "vendor/package" composer.json

Confirmed by getcomposer.org

Did this fix it?

Cause 3 of 3

The whole project needs pre-releases but its floor is still stable

1Check

minimum-stability is a root-only setting. It defaults to stable and removes every less stable version from dependency resolution, for all packages, not just the one you named.

grep -n -E "minimum-stability|prefer-stable" composer.json

2Fix

Lower the floor to the least stable level you accept and turn on prefer-stable. Composer then picks stable releases whenever a compatible one exists and falls back to a pre-release only when it has to.

{
    "minimum-stability": "beta",
    "prefer-stable": true
}

3Verify

Run the require again without a version.

composer require vendor/package

Confirmed by getcomposer.org

Did this fix it?

How do I stop it coming back?

  • Give every package an explicit constraint in composer.json instead of relying on require to choose one.
  • Keep minimum-stability at stable for production projects, and use per-package flags for the rare pre-release.
  • When you do lower minimum-stability, set prefer-stable to true in the same edit.
  • Ask library authors to tag releases, so users do not have to depend on a branch name.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

Apache returns 403 when a URL contains %3F

a request like /page%3Fname=test is refused while /page?name=test works

Recent Apache httpd blocks a rewrite when the request contains an encoded question mark (%3F) and the rewritten target has a literal ?.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.