3

I want to add this tag from the branch 1.x to my project.

I specified: "monolog/monolog": "dev-1.x#1.23.0"

And ran composer update monolog/monolog

Composer says:

Problem 1
    - The requested package monolog/monolog dev-1.x#1.23.0 exists as monolog/monolog[1.0.0, 1.0.0-RC1, 1.0.1, 1.0.2, 1.1.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.17.2, 1.18.0, 1.18.1, 1.18.2, 1.19.0, 1.2.0, 1.2.1, 1.20.0, 1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.9.1, 1.x-dev, dev-master, 2.x-dev] but these are rejected by your constraint.

I want to pull specific tag from specific branch. What do I do? this answer suggests I should be ok.

UPDATE:

After following Loek's advise and removing everything before the actual tag I get this: The requested package monolog/monolog (installed at 1.21.0, required as 1.23.0) is satisfiable by monolog/monolog[1.21.0] but these conflict with your requirements or minimum-stability.

I already have "minimum-stability": "dev" set up.

IMSoP
  • 89,526
  • 13
  • 117
  • 169
user3081519
  • 2,659
  • 5
  • 25
  • 35
  • Just remove the `dev-1.x#`. – Loek Jul 09 '18 at 08:22
  • @Loek It will then pull from master branch which is not what I want. – user3081519 Jul 09 '18 at 08:28
  • 1
    No, you will get the specific tag `1.23.0`. It doesn't matter if that is master, or a feature branch created 10 years ago. If it was tagged as `1.23.0` by the owner, you will always get that tag. – Loek Jul 09 '18 at 08:29
  • @Loek, ok that seems to have moved me a bit further. Updated the question with a new error message. – user3081519 Jul 09 '18 at 08:33
  • 1
    Then there's probably another package that is using monolog `1.21.0`. Could you try a `composer update` without any arguments? Or would that mess up your installation? – Loek Jul 09 '18 at 08:39
  • @Loek Okaay. Well that was a super unhelpful error message. Thanks a lot for guiding me through. Please convert to an answer and I will accept. If I wanted to figure out what holds it up in the future should I just add a ```--debug``` flag or something of a sort? – user3081519 Jul 09 '18 at 08:45
  • You could always do that. I've run into countless of composer error messages so I often sort of know what's up. What often helps is not trying to update one package, but to update everything at once. That at least shows what packages collide. Please upvote IMSoP too, his answer is pretty good as well. – Loek Jul 09 '18 at 08:46

4 Answers4

6

You can use the composer why-not command to see what packages are conflicting with the version you've specified.

So, without any changes to your composer.json, run:

composer why-not monolog/monolog 1.23.0

This should tell you where the conflict is occurring.

There are also some things you can do to make such conflicts less likely:

  • Be less strict in your version constraints. Pegging to a specific version of a package gives Composer less freedom to find a working set of packages.
  • Edit your constraints, and then run composer update without any arguments, to let Composer find the best set of packages that meets those constraints, rather than forcing it to change one package at a time.
IMSoP
  • 89,526
  • 13
  • 117
  • 169
1

I have had the same issue and the problem was on Packagist, I updated the release on Github and it was not updated on Packagist yet. So after updating it there the problem got fixed.

0

You can just specify the tag you want to download. If the package maintainers tagged their versions well, it doesn't matter on what branch or what stability it is. If you specify 1.23.0, it will always pull in 1.23.0.


EDIT

There is probably some package colliding. Check @IMSoP's answer for an easier way to resolve than mine.

Mine would be: update all the packages and Composer should show what packages are colliding.

Loek
  • 4,037
  • 19
  • 35
0

I had a similar issue with phpmyadmin after some time keeping intact. version 4.5.0 which I realized was not existing, either deleted or wrongly inputted in past

What seems to help me was manually editing - removing the record from composer.json and issuing composer install command.

The next step was installing one of the concreted versions which was already mentioned like problematic - rejected by constrains 4.7.0 - php7.0 composer install phpmyadmin/phpmyadmin:4.7.0

I had also added along two settings - but those didn't seem to work alone

"minimum-stability": "dev", "prefer-stable": true,

My original error message was

Problem 1 - The requested package phpmyadmin/phpmyadmin 4.5.0.* exists as phpmyadmin/phpmyadmin[4.0.0, 4.0.1, 4.0.10, 4.0.10.1, 4.0.10.2, 4.0.10.3, 4.0.10.4, 4.0.10.5, 4.0.10.6, 4.0.10.7, 4.0.10.8, 4.0.10.9, 4.0.2, 4.0.3, 4.0.4, 4.0.4.1, 4.0.4.2, 4.0.5, 4.0.6, 4.0.7, 4.0.8, 4.0.9, 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.7.4, 4.7.5, 4.7.6, 4.7.7, 4.7.8, 4.7.9, 4.7.x-dev, 4.8.0, 4.8.0.1, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, 4.8.x-dev, 4.9.0, 4.9.0.1, 4.9.1, 4.9.x-dev, 5.0.x-dev, dev-master, 5.1.x-dev] but these are rejected by your constraint.

FantomX1
  • 1,577
  • 2
  • 15
  • 23