外部存储库的Composer依赖性问题 [英] Composer dependency issue with external repository

查看:146
本文介绍了外部存储库的Composer依赖性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个我想在另一个项目中使用的库。但是,当我将库依赖项添加到项目中时,运行 composer update -vvv 后会出现以下错误:

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.

这个错误对我来说非常令人困惑,因为我的项目只有自己的库,因为我的库是我的项目,即我的项目 composer.json 看起来像这样:

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.*"
    }
}

您可以看到,很简单。我的库版本需要 dev-master 的原因是因为 master 当前是我唯一处理的分支(我一个人工作,暂时不需要其他分支。)

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).

到目前为止,解决此问题的唯一方法是添加库的依赖项 composer.json 到我项目的 composer.json 中,这似乎是不必要的步骤。

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?

推荐答案

在我看来,这似乎是一个稳定性问题。将以下两行添加到您的composer.json中:-

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:-最低稳定性& 偏好稳定

ref:- minimum-stability & prefer-stable

希望这能解决您的问题。

Hopefully that will sort out your problem.

这篇关于外部存储库的Composer依赖性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆