与外部存储库的Composer依赖问题

时间:2014-04-09 00:53:04

标签: php composer-php dependency-management

我写了一个我想在另一个项目中使用的库。但是,当我将库依赖项添加到我的项目时,运行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看起来像这样:

{
    "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目前是我工作的唯一分支(我单独工作,目前不需要其他分支)。

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

如何解决此依赖性问题?

1 个答案:

答案 0 :(得分:2)

我认为这似乎是一个稳定性问题。将以下两行添加到composer.json中: -

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

参考: - minimum-stability&amp; prefer-stable

希望这能解决你的问题。