即使依赖项版本号在范围内,composer也拒绝安装包

时间:2014-11-22 01:25:44

标签: php laravel-4 composer-php

我的package依赖于illuminate/support ~4.1

我正在尝试在composer.json文件要求"laravel/framework": "4.1.*"的Laravel项目中安装此软件包。

但是当我运行composer require并尝试安装此软件包时,我每次都会遇到此错误:

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

  Problem 1
    - Conclusion: remove laravel/framework v4.1.29
    - adityamenon/postcodes-io-laravel 1.0.0 requires illuminate/support 4.2.* -> satisfiable by illuminate/support[v4.2.1, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
    - adityamenon/postcodes-io-laravel 1.0.1 requires illuminate/support 4.2.* -> satisfiable by illuminate/support[v4.2.1, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
    - don't install illuminate/support v4.2.1|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.2|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.3|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.4|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.5|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.6|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.7|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.8|don't install laravel/framework v4.1.29
    - don't install illuminate/support v4.2.9|don't install laravel/framework v4.1.29
    - Installation request for laravel/framework == 4.1.29.0 -> satisfiable by laravel/framework[v4.1.29].
    - Installation request for adityamenon/postcodes-io-laravel ~1.0 -> satisfiable by adityamenon/postcodes-io-laravel[1.0.0, 1.0.1].


Installation failed, reverting ./composer.json to its original content.

我做错了什么?

2 个答案:

答案 0 :(得分:2)

您安装adityamenon/postcodes-io-laravel ~1.0,因为我们在错误消息的最后一项中读到了:

  

adityamenon / postcodes-io-laravel~1.0的安装请求 - > adityamenon / postcodes-io-laravel [1.0.0,1.0.1]可以满足。

这意味着1.0.0或1.0.1(也显示在此项目中)。查看packagist,1.0.0和1.0.1都需要illuminate/support 4.2。*(显示在错误消息的第二和第三项中)。您安装laravel/framework 4.1。*。由于4.1.*不在4.2.*范围内(包所需的版本),因此它会失败。

您可能希望安装开发版本,您可以使用@dev标记该版本:

{
    ...
    "require": {
        "adityamenon/postcodes-io-laravel": "dev-master"
    }
}

顺便说一句,真正依赖dev-master并不是一个好主意。您应该始终尝试将master分支别名为特定的dev版本。

答案 1 :(得分:1)

您似乎是该套餐的作者。

  

我的包依赖于照亮/支持~4.1。

这对于所有已发布的版本1.0.0和1.0.1都是错误的 - 这些版本依赖于illuminate / support 4.2。*。

只有master分支依赖于~4.1 - 如果你想发布它,只需将当前主分支标记为版本1.0.2或1.1.0(取决于是仅进行了错误修正还是更改了它的接口) - 也许它甚至是一个不兼容的2.0.0版本。)

然后,您可以更新其他软件以与Laravel 4.1一起使用您的软件包。