Composer dependency issue with external repository

我是研究僧i 提交于 2020-01-06 08:29:58

问题


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.

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

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

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?


回答1:


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:- minimum-stability & prefer-stable

Hopefully that will sort out your problem.



来源:https://stackoverflow.com/questions/22950932/composer-dependency-issue-with-external-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!