Composer error: no matching package found - php

I have two Symfony projects: project-a (root project) and project-b.
My composer.json file from project-a contains:
{
"name": "myprojects/project-a",
"require": {
"myprojects/project-b": "dev-master",
},
"repositories": [
{
"type": "vcs",
"url": "git#bitbucket.org:MYPROJECTS/project-b.git"
}
]
}
And my composer.json from project-b:
{
"name": "myprojects/project-b",
"require": {
"guzzlehttp/guzzle": "^6.3"
}
}
I need to update project-b but when I execute the command composer update myprojects/project-b from project-a, I get this composer error:
[Composer\DependencyResolver\SolverProblemsException]
Problem 1
Installation request for myprojects/project-b dev-master -> satisfiable by
myprojects/project-b[dev-master].
myprojects/project-b dev-master requires guzzlehttp/guzzle ^6.3 -> no matching package found.
Potential causes:
A typo in the package name
The package is not available in a stable-enough version according to your minimum-stability setting
I have tried solve this adding "minimum-stability": "dev" property to both composer.json files, but it doesn't works.. How can I solve this?
Thanks.

As commented in guzzle/guzzle issue 861:
Looks like an issue with your caching.
Try clearing your composer cache, and self-update composer, then try again.
The OP Wildchild confirms in the comments:
composer clear cache and self-update solves my problem
"minimum-stability": "dev" is not needed.

Related

Getting "Could not find a version of package .." in composer inspite of having tags in Github branch of package

I am learning on how to upload a package on packagist.org. I created a github repository for testing with composer.json file -
https://github.com/perials/check
and a composer package using this github repository - https://packagist.org/packages/perials/check
When I try to install this package using composer require perials/check I get below error
[InvalidArgumentException]
Could not find a version of package perials/check matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.
From what I read in other related questions on SO this error occurs if there are no stable releases of github branch. But thing is that I already have some releases.
I also tried composer require perials/check:dev-master and composer require perials/check:7.1.0 but then I get below error
[InvalidArgumentException]
Could not find package perials/check.
Did you mean this?
perials/check
It was an issue with Singapore mirror for the packagist metadata. Now it should be resolved. https://github.com/composer/composer/issues/8347#issuecomment-537176755
If still not solve your issue please add "minimum-stability": "dev" in your composer.json
{
"name": "perials/check",
"description": "Package for testing packagist",
"license": "MIT",
"authors": [
{
"name": "Perials",
"email": "info#perials.com"
}
],
"autoload": {
"psr-4": {"Abc\\": "src/xyz"}
},
"require": {},
"minimum-stability": "dev"
}
I am also learning how to create packages and have the same problem, but in my case I created a v1.0.0 tag for my package and that solves the problem.
You can accept no stable version packages. See composer in docs (https://getcomposer.org/doc/04-schema.md#package-links).
Paste piece here for convinience:
You can apply them to a constraint, or apply them to an empty constraint if you want to allow unstable packages of a dependency for example.
composer.json:
{
"require": {
"monolog/monolog": "1.0.*#beta",
"acme/foo": "#dev"
}
}
In your case you would do:
{
"require": {
"perials/check": "7.1.0#dev"
}
}
and then run rm composer.lock; composer install.

Library requires "dev-master" and a stable version

I am developing an add-on (atk4/audit) for a framework (atk4/data). My basic composer.json looks like this:
{
"type": "library",
"name": "atk4/audit",
"require": {
"atk4/data": "^1.3",
"php": ">=5.6.0"
}
}
This works fine and if composer require atk4/audit is used, then atk4/audit[1.0] and atk4/data[1.3] is installed.
However when attempted to use development branches:
{
"require": {
"atk4/data": "dev-develop",
"myaddon/addon": "dev-develop"
}
}
composer responds with error:
Problem 1
- Installation request for atk4/data dev-develop -> satisfiable by atk4/data[dev-develop].
- atk4/data dev-develop requires atk4/dsql dev-develop -> satisfiable by atk4/dsql[dev-develop] but these conflict with your requirements or minimum-stability.
Problem 2
- Installation request for atk4/audit dev-develop -> satisfiable by atk4/audit[dev-develop].
- atk4/audit dev-develop requires atk4/schema dev-develop -> satisfiable by atk4/schema[dev-develop] but these conflict with your requirements or minimum-stability.
I want my library to be usable in both "stable" and "dev-develop" versions. I have tried setting composer.json like this for the library:
{
"type": "library",
"name": "atk4/audit",
"require": {
"atk4/data": "dev-develop,^1.3",
"php": ">=5.6.0"
}
}
but, this does not work. I haven't found any mentions of this issue anywhere, I wonder if I'm on the wrong path?
When defining an unstable dependency with Composer, you need to specify the minimum stability.
{
"require": {
"atk4/data": "dev-develop",
"myaddon/addon": "dev-develop"
},
"minimum-stability": "dev"
}
You should also add "prefer-stable": true, otherwise all non-versionned packages in composer.json will be updated to the unstable branch.

Composer dependency issue with external repository

I have written a library that I want to use in another project. However, when I add the library dependency to my project I get the following error after running composer update -vvv:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for my/library dev-master -> satisfiable by my/library[dev-master].
- my/library dev-master requires doctrine/migrations dev-master -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
This error is very confusing to me since my project has my library as it's only dependency, i.e. my project composer.json looks like this:
{
"name": "my/project",
"type": "project",
"description": "My project",
"autoload": {
"psr-0": { "MyNamespace\\": ["src/", "tests/src/"] }
},
"repositories": [ {
"type": "vcs",
"url": "git#bitbucket.org:my/library"
} ],
"require": {
"php": ">=5.5",
"my/library": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "3.*"
}
}
As you can see, pretty straight forward. The reason the version of my library is requiring dev-master is because master is currently the only branch I work on (I work alone, no need for other branches at the moment).
So far the only way for the resolve this problem is by adding the dependencies of my library composer.json to my project's composer.json which seems like an unnecessary step.
How can I resolve this dependency issue?
It looks to me as if it is a stability issue. Add the following two lines to your composer.json:-
"minimum-stability": "dev",
"prefer-stable": true,
ref:- minimum-stability & prefer-stable
Hopefully that will sort out your problem.

Composer dependency error acquiring microsoft/windowsazure package

I'm having difficulty getting the PHP client libraries package for Windows Azure via Composer. The problem would appear to be around Pear dependencies the package has.
The contents of the composer.json file:
{
"require": {
"microsoft/windowsazure": "dev-dev"
},
"repositories": [
{
"type": "pear",
"url": "http://pear.php.net"
}
]
}
The output following running "composer update" reads:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for microsoft/windowsazure dev-dev -> satisfiable by microsoft/windowsazure[dev-dev].
- microsoft/windowsazure dev-dev requires pear-pear/http_request2 * -> no matching package found.
I've never experienced any difficulty getting this package in the past. I can provide more verbose logs on request.
I recall seeing a few issues raised due to changes in how replaces works in regards to pear bridging.
This issue needs to be fixed upstream to have pear-pear/* replaced with pear-pear.php.net/*, but as a workaround in your root composer.json you can explicitly require the dependencies in order to have them discovered by the solver.
{
"require": {
"microsoft/windowsazure": "dev-dev",
"pear-pear.php.net/http_request2": "*",
"pear-pear.php.net/mail_mime": "*",
"pear-pear.php.net/mail_mimedecode": "*"
},
"repositories": [
{
"type": "pear",
"url": "http://pear.php.net"
}
]
}
The above composer.json should work in the latest and future versions of composer. Tested with Composer version aa9c257f0efd1a54c93ba95282821a497bc15d75 2014-03-09 15:09:15
This is a composer bug, I fixed it by using an older version of composer. Your composer.json is fine. The version I used was:
Composer version 42c496752ab6ec6c45b185b70c8c39220da01b1c
https://github.com/composer/composer/archive/42c496752ab6ec6c45b185b70c8c39220da01b1c.zip

Composer phar package not found

I am trying to create a new composer library package.
I created the composer.json file using the
composer.phar create-project xlix vendor/xlix/xlix 0.3
command.
In the filesystem the file composer.json exists under vendor/xlix/xlix and for testing purposes I copied it to vendor/xlix.
The composer.json file content is the following:
{
"name": "xlix/xlix",
"type": "library",
"description": "XLIX package",
"keywords": ["core"],
"homepage": "http://myhomepage",
"license": "GPL",
"authors": [
{
"name": "Florian Kasper",
"email": "florian.kasper#mymail"
}
],
"require": {
"php": ">=5.2.4"
},
"autoload": {
"psr-0" : {
"Xlix\\Bundle" : "lib/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0"
}
}
}
Then I tried the following commands:
git:(master) ✗ php composer.phar require xlix/xlix
git:(master) ✗ php composer.phat require vendor/xlix
...
git:(master) ✗ php composer.phar install vendor/xlix
git:(master) ✗ php composer.phar install xlix/xlix
...
Every time the same output:
Please provide a version constraint for the xlix/xlix requirement: *
composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package xlix/xlix could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
In my ROOTDIR/composer.json file the package is registered in the require section.
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
"xlix/xlix": ">=0.*"
Now I am on the edge of despair an don't know what to do anymore.
Question:
Are there any mistakes I've made or is there anything i missed?
Packages live on the internet, not on your filesystem.
Composer searches by default for a package called xlix/xlix on packagist and that does not exists. You can add more package repositories by using the repositories configuration, more about that in the documentation.
So, in order to require your package with composer you need to upload your xlix directory somewhere.
I don't see what you are trying to do in the lxix directory? You are in the lxix package, why do you want to require it in the same package? It looks like you don't understand what those commands do and how composer works. Maybe a good read in their own documentation -- or some other tutorials about Composer (like the one on nettuts+) -- will help you to get a better understanding of composer.

Categories