Zend Framework 2 - 作曲家 - Behat / Guzzle Conflict

时间:2012-11-22 11:06:08

标签: php composer-php behat

这是我的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

我明白了:

使用包信息加载composer存储库 更新依赖项 您的要求无法解析为可安装的软件包。

  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文件几个星期了,它总是安装好。

2 个答案:

答案 0 :(得分:2)

问题似乎是你需要在require-dev中使用guzzle / http 2.8.*。由于2.8.8已安装在您的dev依赖项中,因此当您尝试更新时,它将首先更新正常需求,同时完全阻止dev需求的更改。

此时,由于fabpot / goutte现在显然需要gu 3.0.*,因此它向南移动,因为它希望保留2.8.8并需要安装3.0.*

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

答案 1 :(得分: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/"
        }
    }
}