PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 9, 2022

[FIXED] Why can't I require a specific commit from "dev-master" for this package?

 February 09, 2022     composer-php, git, php     No comments   

Issue

I'm trying to install apigen/apigen via Composer (specifically, dev-master). The latest commit requires roave/better-reflection at a certain commit. I ran into issues where Composer was unable to find that particular reference (#c87d856).

To reproduce the issue, I created a minimal composer.json file that requires only that missing package/version:

{
    "name": "a-vendor/some-library",
    "type": "library",
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "roave/better-reflection",
                "version": "dev-master#c87d856",
                "source": {
                    "type": "git",
                    "url": "https://github.com/roave/BetterReflection.git",
                    "reference": "commit/c87d856"
                }
            }
        }
    ],
    "require-dev": {
        "roave/better-reflection": "dev-master#c87d856"
    }
}

I was hoping that adding that repository as a package might work around the issue. I thought the difference between the repo and package name might be the problem). However, I get the same issue, with the message:

The requested package roave/better-reflection dev-master#c87d856 exists as roave/better-reflection[0.1.0, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 2.0.0, 2.0.1, 2.0.2, 3.0.0, 3.1.0, 3.1.1, 3.2.0, 3.3.0, 3.4.0, 3.5.0, 4.0.0, 4.1.0, 4.10.0, 4.10.x-dev, 4.11.0, 4.11.x-dev, 4.12.x-dev, 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.6.1, 4.7.0, 4.8.0, 4.8.x-dev, 4.9.0, 4.9.x-dev, dev-dependabot/composer/doctrine/coding-standard-8.2.0, dev-dependabot/composer/infection/infection-0.17.5, dev-dependabot/composer/phpstan/phpstan-0.12.48, dev-dependabot/composer/phpstan/phpstan-0.12.52, dev-dependabot/composer/phpstan/phpstan-0.12.53, dev-dependabot/composer/vimeo/psalm-3.16, dev-dependabot/composer/vimeo/psalm-3.18.2, dev-implement-newInstanceArgs, dev-master#c87d856] but these are rejected by your constraint.

You can see that the repository that I added is there at the end of the list, but Composer doesn't pick it up as a match.

Does anyone have any ideas about how I can help Composer locate this version/commit, and have that work for the dependency (apigen/apigen) that requires it?


Solution

$ composer req --dev roave/better-reflection:4.12.x-dev#c87d856

There is no master branch for that repo, and it seems that the branch 4.12.x has been aliased to 4.12.x-dev (packagist).



Answered By - yivi
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing