无法将需求解析为一组可安装的软件包

Posted

技术标签:

【中文标题】无法将需求解析为一组可安装的软件包【英文标题】:Requirements could not be resolved to an installable set of packages 【发布时间】:2014-01-26 14:52:00 【问题描述】:

我试图在 laravel-starter-kit 中安装 jasonlewis/enhanced-router 包,但当我运行 composer update 时它没有安装并出现一些错误。最初我认为问题出在 jasonlewis/enhanced-router ("jasonlewis/enhanced-router": "dev-master") 的作曲家行,但我删除了它并遇到了同样的错误。

我试图搜索一些类似的问题,但无法弄清楚我遇到的依赖问题是什么。

下面是我运行composer update后得到的结果:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework 4.0.x-dev
    - Conclusion: don't install laravel/framework 4.0.x-dev
    - Conclusion: don't install laravel/framework v4.0.10
    - Conclusion: don't install laravel/framework v4.0.9
    - Conclusion: don't install laravel/framework v4.0.8
    - Conclusion: don't install laravel/framework v4.0.7
    - Conclusion: don't install laravel/framework v4.0.6
    - Conclusion: don't install laravel/framework v4.0.5
    - Conclusion: don't install laravel/framework v4.0.4
    - Conclusion: don't install laravel/framework v4.0.3
    - Conclusion: don't install laravel/framework v4.0.2
    - Conclusion: don't install laravel/framework v4.0.1
    - Conclusion: don't install laravel/framework v4.0.0
    - Conclusion: don't install laravel/framework v4.0.0-BETA4
    - Installation request for zizaco/confide dev-master -> satisfiable by zizaco/confide[dev-master].
    - Conclusion: don't install laravel/framework v4.0.0-BETA3
    - bllim/datatables dev-master requires illuminate/filesystem >=4.0.0 -> satisfiable by laravel/framework[4.0.x-dev,
4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.
9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9], illuminat
e/filesystem[4.0.x-dev, 4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.
6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4
.1.8, v4.1.9].
    - bllim/datatables 1.3.0 requires illuminate/filesystem >=4.0.0 -> satisfiable by laravel/framework[4.0.x-dev, 4.1.x
-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4
.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9], illuminate/fil
esystem[4.0.x-dev, 4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4
.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8,
 v4.1.9].
    - bllim/datatables dev-master requires illuminate/filesystem >=4.0.0 -> satisfiable by laravel/framework[4.0.x-dev,
4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.
9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9], illuminat
e/filesystem[4.0.x-dev, 4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.
6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4
.1.8, v4.1.9].
    - bllim/datatables v1.3.1 requires illuminate/filesystem >=4.0.0 -> satisfiable by laravel/framework[4.0.x-dev, 4.1.
x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v
4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9], illuminate/fi
lesystem[4.0.x-dev, 4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v
4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8
, v4.1.9].
    - bllim/datatables v1.3.2 requires illuminate/filesystem >=4.0.0 -> satisfiable by laravel/framework[4.0.x-dev, 4.1.
x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v
4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9], illuminate/fi
lesystem[4.0.x-dev, 4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v
4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8
, v4.1.9].
    - bllim/datatables v1.3.3 requires illuminate/filesystem >=4.0.0 -> satisfiable by laravel/framework[4.0.x-dev, 4.1.
x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v
4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9], illuminate/fi
lesystem[4.0.x-dev, 4.1.x-dev, dev-master, 4.2.x-dev, v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v
4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8
, v4.1.9].
    - Can only install one of: laravel/framework[v4.0.0-BETA2, 4.1.x-dev].
    - Can only install one of: laravel/framework[v4.0.0-BETA2, dev-master].
    - Can only install one of: laravel/framework[v4.0.0-BETA2, 4.2.x-dev].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.1, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.10, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.11, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.12, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.2, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.3, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.4, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.5, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.6, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.7, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.8, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.9, v4.0.0-BETA2].
    - don't install illuminate/filesystem 4.0.x-dev|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.0|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.1|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.10|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.2|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.3|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.4|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.5|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.6|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.7|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.8|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.0.9|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem 4.1.x-dev|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem 4.2.x-dev|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.0|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.1|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.10|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.11|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.12|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.2|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.3|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.4|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.5|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.6|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.7|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.8|don't install laravel/framework v4.0.0-BETA2
    - don't install illuminate/filesystem v4.1.9|don't install laravel/framework v4.0.0-BETA2
        - don't install illuminate/filesystem dev-master|don't install laravel/framework v4.0.0-BETA2
        - Installation request for laravel/framework 4.0.* -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BET
    A2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
        - Installation request for bllim/datatables * -> satisfiable by bllim/datatables[1.3.0, dev-master, v1.3.1, v1.3.2,
    v1.3.3].

还有我的 composer.json


    "name": "andrew13/Laravel-4-Bootstrap-Starter-Site",
    "description": "Laravel 4 Starter Site",
    "keywords": ["laravel","Starter Site"],
    "license": "MIT",
    "authors": [
        
            "name": "Andrew Elkins",
            "homepage": "http://www.andrewelkins.com"
        
    ],
    "require": 
        "laravel/framework": "4.0.*",
        "twbs/bootstrap":  "3.0.0",
        "zizaco/confide": "dev-master",
        "zizaco/entrust": "dev-master",
        "jasonlewis/basset": "dev-master",
        "robclancy/presenter": "1.2.*",
        "j20/php-uuid": "dev-master",
        "bllim/datatables": "*",
        "blueimp/jquery-file-upload": "dev-master",
        "jasonlewis/enhanced-router": "dev-master"
    ,
    "require-dev": 
        "way/generators": "dev-master",
        "mockery/mockery": "dev-master@dev",
        "summerstreet/woodling": "0.1.*",
        "barryvdh/laravel-ide-helper": "dev-master",
        "leafo/lessphp": "v0.4.0",
        "natxet/CssMin": "dev-master",
        "lmammino/jsmin4assetic": "1.0.*"
    ,
    "autoload": 
        "classmap": [

            "app/commands",
            "app/controllers",
            "app/library",
            "app/models",
            "app/presenters",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/library"
        ]
    ,
    "scripts": 
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-install-cmd": [
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ]
    ,
    "config": 
        "preferred-install": "dist"
    ,
    "minimum-stability": "dev"

我不是从基本的 Laravel 包开始的,我用过andrew13/Laravel-4-Bootstrap-Starter-Site

【问题讨论】:

【参考方案1】:

欢迎使用 Composer 最糟糕的功能!

所以问题是您的依赖项中存在难以发现的冲突。

您的 composer.json 中有"laravel/framework": "4.0.*", 的要求。你还需要"zizaco/confide": "dev-master"

在 github 中的 composer.json 中查找“zizaco/confide”,我们看到:

“照亮/支持”:“4.1.x”,

导致您出现问题的 Composer 功能是 replace 关键字在整个 PACKAGIST 中全局操作

所以因为'illuminate/support' package is replace'd by Laravel itself Composer 尝试满足 "illuminate/support": "4.1.x" 的要求时,它实际上尝试下载 laravel 4.1.x 版本。

这与您对 laravel 版本 4.0.* 的要求相冲突,因此无法解析依赖项集。

我认为您的问题可能没有简单的解决方案。

我将建议指定一个较早版本的 zizaco/confide 而不是 dev-master,它依赖于Illumination/support 版本 4.0.x 而不是 4.1.x - 但是这意味着从 zizaco/confide 3 切换。 x 到 2.x,这可能是不可接受的。

唯一的其他选择是将您的要求从 laravel 4.0.x 更改为 4.1.* - 这可能会或可能不会接受,具体取决于您需要做多少工作。

【讨论】:

他可以分叉并更改作曲家,不是吗? 他可以,但是由于各种原因,为了进行小改动而分叉代码在 Composer 中真的很烦人。 顺便说一句,如果有人带着other方式的需求不匹配来到这里——你尝试安装的包需要一个older的依赖项比已经安装的——你可以简单地手动 composer require 旧包。然后安装你想要的任何包,它的要求就会得到满足。您可以通过将旧版本附加到 require 语句来做到这一点。例如,composer require symfony/event-dispatcher ~2.2. 谢谢@TylerHayes!您的评论真的很有帮助! 我是 Composer 的新手,我希望再过几年我就能弄清楚这一点:为什么它会尝试自行更改您的版本控制要求并安装 Laravel 4.1.x?那是错字吗?我遇到了同样的问题,我开始担心没有解决方案。

以上是关于无法将需求解析为一组可安装的软件包的主要内容,如果未能解决你的问题,请参考以下文章

symfony - 您的需求无法解析为一组可安装的软件包

Composer Laravel 安装错误:您的需求无法解析为一组可安装的软件包

Laravel 中的 Composer 更新错误“需求无法解析为一组可安装的软件包”[重复]

composer requireIllumination/support 会给出一个错误,例如“您的需求无法解析为一组可安装的软件包”。

Laravel 7 w/ Laravel Excel:您的需求无法解决为一组可安装的软件包

您的要求无法解析为一组可安装的软件包(Composer 更新)