Composer says a package could not be found in any version
The requested package ... could not be found in any versionShort answer
Composer can only install what its repositories list at a stability it allows. The error comes from a mistyped name, a minimum-stability that hides the only version, or a Git package that was never declared in the root composer.json. A branch also needs the dev- prefix.
Fix it fast
1Find out which cause you have
Run the failing command with verbose output. It shows which repositories Composer asked and what it found.
composer update -v2Match what you see, then jump to its fix
- 1
The package is not found even though you expect it on PackagistThe package name or version has a typoFix - 2
The package has only dev, alpha or beta releasesminimum-stability hides the only versionFix - 3
The package is a private or forked repository that is not on PackagistA Git package is not declared in the root composer.jsonFix - 4
You just tagged a version and Composer cannot see itThe release is brand newFix
- 1
What does the error look like?
The requested package ... could not be found in any version
Cause 1 of 4
The package name or version has a typo
1Check
Check the vendor/name pair and the branch or tag name in composer.json for typos. Run the built-in checks too.
composer diagnose
composer why-not vendor/package 2.02Fix
Correct the name and constraint to match the package page.
composer require vendor/package3Verify
Composer resolves and installs the package.
composer update vendor/package -vConfirmed by getcomposer.org
Cause 2 of 4
minimum-stability hides the only version
1Check
The default minimum-stability is stable, so versions less stable than that are ignored. Set it to dev temporarily to rule this out.
grep -n "minimum-stability" composer.json2Fix
Allow the one package with an inline flag, or lower the stability in the root composer.json and keep prefer-stable on.
"require": {
"vendor/package": "^1.0@beta"
}3Verify
Run the require again and read the chosen version.
composer require vendor/package:^1.0@betaConfirmed by getcomposer.org
Cause 3 of 4
A Git package is not declared in the root composer.json
1Check
A repositories entry only counts in the root package. One that sits inside a dependency's composer.json is ignored.
grep -n -A4 "repositories" composer.json2Fix
Declare the repository in the root composer.json, keep the original package name, and use the dev- prefix for a branch.
{
"repositories": [
{ "type": "vcs", "url": "https://github.com/acme/forked-package" }
],
"require": {
"acme/forked-package": "dev-bugfix"
}
}3Verify
Update the one package.
composer update acme/forked-package -vConfirmed by getcomposer.org
Cause 4 of 4
The release is brand new
1Check
New versions can take up to a minute to appear on Packagist. Clear the local cache before you try again.
composer clear-cache2Fix
Wait a minute, clear the cache and run the update again.
composer update vendor/package3Verify
The new version shows up.
composer update vendor/package -vConfirmed by getcomposer.org
How do I stop it coming back?
- Copy the exact package name from its Packagist page.
- Keep private repository entries in the root composer.json and commit it.
- Tag releases in Git so a constraint can match them.
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
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack 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 fixBack end
Apache returns 500 with Premature end of script headers
500 Internal Server Error
Apache ran your script, but the script printed no valid HTTP header before its output.
3 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fix