【问题标题】:composer install a package fail作曲家安装包失败
【发布时间】:2017-09-15 08:13:03
【问题描述】:

我需要在我的 laravel 项目中包含一个非作曲家存储库(https://github.com/ECPay/ECPayAIO_PHP) 但出现错误:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package ecpay/ecpayaio_php 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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

这是我的composer.json 文件

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "ECPay/ECPayAIO_PHP",
                "version": "dev-master",
                "source": {
                    "url": "https://github.com/ECPay/ECPayAIO_PHP",
                    "type": "git",
                    "reference": "origin/master"
                }
            }
        }
    ],
    "require": {
        "ECPay/ECPayAIO_PHP": "master"
    }
}

听起来像是包名错误,这不是"ECPay/ECPayAIO_PHP"吗?,有什么想法吗?

【问题讨论】:

    标签: php git github composer-php


    【解决方案1】:

    要使用 git repo 作为 composer 包的来源,您只需在存储库列表中将存储库定义为 type=vcs,然后 composer 应该能够找到您的包。相关文档在这里:https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository

    如果你想要一个更详细的例子,当我遇到同样的问题(https://lornajane.net/posts/2014/use-a-github-branch-as-a-composer-dependency)时,我也写了一篇博客——请注意,如果你想要 master 分支中的版本,包版本想要是 dev-master

    【讨论】:

      猜你喜欢
      • 2018-06-22
      • 2021-11-03
      • 2017-02-14
      • 2013-06-02
      • 2018-12-28
      • 2021-10-05
      • 2016-02-27
      • 1970-01-01
      相关资源
      最近更新 更多