1

这是我的 composer.json 文件:

{
    "name": "lorem-ipsum",
    "description": "Lorem Ipsum",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4",
        "symfony/console": ">=2.0.0,<2.2.0-dev",
        "symfony/config": ">=2.0.0,<2.2.0-dev",
        "symfony/dependency-injection": ">=2.0.0,<2.2.0-dev",
        "symfony/event-dispatcher": ">=2.0.0,<2.2.0-dev",
        "symfony/translation": ">=2.0.0,<2.2.0-dev",
        "symfony/yaml": ">=2.0.0,<2.2.0-dev",
        "symfony/finder": ">=2.0.0,<2.2.0-dev",
        "zendframework/zendframework": "2.*",
        "doctrine/doctrine-module": "dev-master",
        "doctrine/doctrine-orm-module": "0.*",
        "gedmo/doctrine-extensions": "dev-master"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.*",
        "behat/behat": "2.4.*@stable",
        "behat/mink": "1.4@stable",
        "behat/mink-goutte-driver": "*",
        "symfony/browser-kit": "2.1.*",
        "symfony/css-selector": "2.1.*",
        "symfony/dom-crawler": "2.1.*",
        "symfony/process": "2.1.*",
        "guzzle/http": "2.8.*",
        "behat/mink-sahi-driver": "*"
    },
    "autoload": {
        "psr-0": {
            "Behat\\Behat": "src/"
        }
    }
}

当我做:

php composer.phar update --dev

我得到:

使用包信息加载作曲家存储库更新依赖项您的需求无法解析为可安装的包集。

  Problem 1
    - Conclusion: remove guzzle/parser v2.8.8
    - Conclusion: don't install guzzle/parser v2.8.8
    - fabpot/goutte 1.0.x-dev requires guzzle/guzzle 3.0.* -> satisfiable by guzzle/guzzle v3.0.0, guzzle/guzzle v3.0.1, guzzle/guzzle v3.0.2, guzzle/guzzle v3.0.3, guzzle/guzzle v3.0.4, guzzle/guzzle v3.0.5.
    - fabpot/goutte 1.0.x-dev requires guzzle/guzzle 3.0.* -> satisfiable by guzzle/guzzle v3.0.0, guzzle/guzzle v3.0.1, guzzle/guzzle v3.0.2, guzzle/guzzle v3.0.3, guzzle/guzzle v3.0.4, guzzle/guzzle v3.0.5.
    - Can only install one of: guzzle/guzzle v3.0.0, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.1, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.2, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.3, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.4, guzzle/guzzle v2.8.8.
    - Can only install one of: guzzle/guzzle v3.0.5, guzzle/guzzle v2.8.8.
    - Installation request for guzzle/parser v2.8.8 -> satisfiable by guzzle/guzzle v2.8.8, guzzle/parser v2.8.8.
    - Installation request for fabpot/goutte 1.0.x-dev -> satisfiable by fabpot/goutte 1.0.x-dev.

几天前没有发生这种情况,我已经使用这个 composer.json 文件几个星期了,它总是安装好。

4

2 回答 2

2

问题似乎是您2.8.*在 require-dev 中需要 guzzle/http。由于2.8.8安装在你的开发依赖中,当你尝试更新它时,它会首先更新正常的需求,同时完全防止开发需求发生变化。

此时,由于 fabpot/goutte 现在显然需要 guzzle 3.0.*,因此它向南走,因为它想保留2.8.8并需要 install 3.0.*

解决方案是 rm -rf vendor/guzzle,以确保当前依赖项已从当前状态消失。然后运行 ​​update 应该会顺利,直到它更新了 dev 依赖项,此时它仍然会抱怨与2.8.8不兼容3.0.*,所以你应该更新你的 require-dev 行以指定3.0.*. 如果这对您来说是个问题,请尝试使用较旧的标记版本的 goutte(如果有)。

于 2012-11-22T16:32:44.020 回答
0

我现在通过明确指定所有包的版本解决了这个问题:

{
    "name": "lorem-ipsum",
    "description": "Lorem ipsum",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4",
        "zendframework/zendframework": "2.0.4",
        "doctrine/doctrine-module": "0.5.2",
        "doctrine/doctrine-orm-module": "0.5.3",
        "gedmo/doctrine-extensions": "2.3.1"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.9",
        "guzzle/guzzle": "3.0.5",
        "behat/behat": "2.4.4",
        "behat/mink": "1.4",
        "behat/mink-goutte-driver": "1.0.3",
        "behat/mink-sahi-driver": "1.0.0",
        "squizlabs/php_codesniffer": "1.4.2",
        "phpmd/phpmd": "1.4.0"
    },
    "autoload": {
        "psr-0": {
            "Behat\\Behat": "src/"
        }
    }
}
于 2012-11-23T13:52:32.923 回答