【问题标题】:Using forked Symfony bundle via composer fails通过作曲家使用分叉的 Symfony 包失败
【发布时间】:2015-11-26 08:01:42
【问题描述】:

我正在尝试安装hslavich/SimplesamlphpBundle。由于此捆绑包与simplesamlphp/simplesamlphp v1.13.2 存在依赖性问题,因此我将forked the repository 改为需要dev-master

现在我相应地修改了我的 Symfony2 的项目 composer.json,以便需要我的分叉包而不是原始包:

{
    ...
    "require": {
        ...
        "hslavich/simplesamlphp-bundle": "dev-master"
    },
    ...
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:saxid/SimplesamlphpBundle.git"
        }
    ]
}

但我仍然收到与未使用分叉一样的错误消息:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - simplesamlphp/simplesamlphp v1.13.2 requires openid/php-openid dev-master#ee669c6a9d4d95b58ecd9b6945627276807694fb as 2.2.2 -> no matching package found.
    - simplesamlphp/simplesamlphp v1.13.1 requires openid/php-openid dev-master#ee669c6a9d4d95b58ecd9b6945627276807694fb as 2.2.2 -> no matching package found.
    - simplesamlphp/simplesamlphp v1.13.0 requires openid/php-openid dev-master#ee669c6a9d4d95b58ecd9b6945627276807694fb as 2.2.2 -> no matching package found.
    - hslavich/simplesamlphp-bundle dev-master requires simplesamlphp/simplesamlphp ~1.13 -> satisfiable by simplesamlphp/simplesamlphp[v1.13.0, v1.13.1, v1.13.2].
    - Installation request for hslavich/simplesamlphp-bundle dev-master -> satisfiable by hslavich/simplesamlphp-bundle[dev-master].

我必须在composer.json 中修改什么才能要求我的分叉?

【问题讨论】:

    标签: git symfony github composer-php


    【解决方案1】:

    尝试删除composer.lock 文件和整个vendor/ 目录。然后运行composer update --prefer-source 以完全刷新依赖项。

    【讨论】:

    • 您可以发布完整的composer.json 文件吗?
    • 这是默认的 Symfony 作曲家文件,添加了我的问题中提到的内容。没有进一步的修改。
    【解决方案2】:

    一个(非常丑陋的)解决方法是将 fork 提交到 packagist 并直接要求 fork 而不是原始包。

    另外:我还必须在我的 Symfony composer.json 中要求 dev-mastersimplesamlphp/simplesamlphp ——尽管这个要求已经在我的分叉包作曲家文件中定义了。

    "require": {
        ...
        "saxid/simplesamlphp-bundle": "dev-master",
        "simplesamlphp/simplesamlphp": "dev-master"
    },
    

    【讨论】:

      【解决方案3】:

      您需要将最低稳定性从stable 降低到dev 才能安装不稳定版本,例如dev-master

      更改您的 composer.json:

      "require": {
          "hslavich/simplesamlphp-bundle": "dev-master"
      },
      "repositories": [
          {
              "type": "vcs",
              "url": "git@github.com:saxid/SimplesamlphpBundle.git"
          }
      ],
      "minimum-stability": "dev",
      "prefer-stable": true
      

      您还需要启用prefer-stable 来告诉作曲家您在可能的情况下需要稳定的软件包。

      【讨论】:

        猜你喜欢
        • 2021-10-05
        • 2015-02-27
        • 2017-09-15
        • 2018-05-08
        • 1970-01-01
        • 2014-04-24
        • 2019-06-04
        • 2020-05-11
        • 2018-06-22
        相关资源
        最近更新 更多