The package is not available in a stable-enough version according to your minimum-stability setting

北战南征 提交于 2019-12-05 16:21:05

问题


I don't really understand how Composer works with the minimum-stability setting.

I have two packages. Let's say, PackageA and PackageB.

The composer.json file of PackageA looks like this:

{
    "name": "vendor/packagea",
    "minimum-stability": "dev",
    "require": {
        "vendor/packageb": "dev"
    }
}

So PackageA requires PackageB. The json of PackageB looks like this:

{
    "name": "vendor/packageb",
    "minimum-stability": "dev"
}

So both say minimum stability are dev. So I assume that when I do:

composer create-project vendor/packagea

But then it complains with the message:

[InvalidArgumentException]
Could not find package vendor/packagea with stability stable.

Which I find strange, because I would assume that setting the minimum stability to dev would pull the package from its "development" branch. Which in the case of github is always dev-master.

So I tried to install it by telling composer what branch to use:

composer create-project vendor/packagea testFolder dev-master

But then it complains that it can't find PackageB:

Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package vendor/packageb dev could not be found.

Then how am I able to install my package? I'm still developing so I dont want to create a release for PackageA and PackageB yet...


回答1:


There are two issues:

In create-project, by default the command uses the stable stability to look for the package to install, that's why it works if you specify dev-master but not by default. You could however also run composer create-project vendor/packagea -s dev

After while installing dependencies, I'm guessing that your package does not exist in a version just called dev, so it can't find it if you require it like that. Requiring dev-master would probably work, like:

{
    "name": "vendor/packagea",
    "minimum-stability": "dev",
    "require": {
        "vendor/packageb": "dev-master"
    }
}



回答2:


How did I fix this?

After installing Composer, run the following command to install the Composer Asset Plugin:

php composer.phar global require "fxp/composer-asset-plugin:^1.2.0"

Now choose one of the application templates to start installing Yii 2.0. An application template is a package that contains a skeleton of the Web application written in Yii.



来源:https://stackoverflow.com/questions/23083045/the-package-is-not-available-in-a-stable-enough-version-according-to-your-minimu

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