Composer 更新 codeception - phpunit 不更新

Posted

技术标签:

【中文标题】Composer 更新 codeception - phpunit 不更新【英文标题】:Composer updating codeception - phpunit does not update 【发布时间】:2017-04-25 01:00:36 【问题描述】:

我跑

rm -rf vendor && composer update codeception/codeception -v

我得到错误:

您的需求无法解决为一组可安装的软件包。

  Problem 1
    - The requested package phpunit/phpunit (locked at 4.1.6, required as 4.8.x-dev) is satisfiable by phpunit/phpunit[4.1.6] but these conflict with your requirements or minimum-stability.
  Problem 2
    - The requested package behat/gherkin (locked at v2.3.5, required as ~4.4.0) is satisfiable by behat/gherkin[v2.3.5] but these conflict with your requirements or minimum-stability.
  Problem 3
    - behat/behat v2.5.5 requires behat/gherkin ~2.3.0 -> satisfiable by behat/gherkin[2.3.x-dev, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5] but these conflict with your requirements or minimum-stability.
    - behat/behat v2.5.5 requires behat/gherkin ~2.3.0 -> satisfiable by behat/gherkin[2.3.x-dev, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5] but these conflict with your requirements or minimum-stability.
    - behat/behat v2.5.4 requires behat/gherkin ~2.3.0 -> satisfiable by behat/gherkin[2.3.x-dev, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5] but these conflict with your requirements or minimum-stability.
    - behat/behat v2.5.3 requires behat/gherkin ~2.3.0 -> satisfiable by behat/gherkin[2.3.x-dev, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5] but these conflict with your requirements or minimum-stability.
    - behat/behat v2.5.2 requires behat/gherkin ~2.3.0 -> satisfiable by behat/gherkin[2.3.x-dev, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5] but these conflict with your requirements or minimum-stability.
    - behat/behat v2.5.1 requires behat/gherkin ~2.3.0 -> satisfiable by behat/gherkin[2.3.x-dev, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5] but these conflict with your requirements or minimum-stability.
    - behat/behat v2.5.0 requires behat/gherkin ~2.2.9 -> satisfiable by behat/gherkin[v2.2.9] but these conflict with your requirements or minimum-stability.
    - Installation request for behat/behat 2.5.* -> satisfiable by behat/behat[v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.5.4, v2.5.5].

目前在require-dev中有如下设置:

"phpunit/phpunit": "4.8.x-dev",
        "phpunit/dbunit": "1.3.*",
        "codeception/codeception": "2.2.7",
        "fzaninotto/faker": "1.4.*",
        "flow/jsonpath": "0.2.*",
        "behat/behat": "2.5.*",
        "behat/gherkin": "~4.4.0",

也是我们公司创建的一个不相关的翻译包。

我正在尝试将 codeception 更新到最新版本。

我已经尝试设置 phpunit 各种版本,但我无法摆脱错误。

我做错了什么?

更新

我更新了 composer.json 以使用与中相同版本的包

composer show

输出,除了

"zendframework/zend-crypt": "2.3.*",

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
    - mabuzagu/pdo-dblib-module dev-master requires doctrine/doctrine-orm-module ^1.0.0 -> satisfiable by doctrine/doctrine-orm-module[1.0.0, 1.1.0].
    - mabuzagu/pdo-dblib-module dev-master requires doctrine/doctrine-orm-module ^1.0.0 -> satisfiable by doctrine/doctrine-orm-module[1.0.0, 1.1.0].
    - doctrine/doctrine-orm-module 1.0.0 requires doctrine/orm >=2.5,<2.7 -> satisfiable by doctrine/orm[v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.5.4, v2.5.5].
    - doctrine/orm v2.5.5 requires doctrine/common >=2.5-dev,<2.7-dev -> satisfiable by doctrine/common[2.5.x-dev, 2.6.x-dev, v2.5.0, v2.5.0-beta1, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2] but these conflict with your requirements or minimum-stability.
    - doctrine/orm v2.5.4 requires doctrine/common >=2.5-dev,<2.7-dev -> satisfiable by doctrine/common[2.5.x-dev, 2.6.x-dev, v2.5.0, v2.5.0-beta1, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2] but these conflict with your requirements or minimum-stability.
    - doctrine/orm v2.5.3 requires doctrine/common >=2.5-dev,<2.7-dev -> satisfiable by doctrine/common[2.5.x-dev, 2.6.x-dev, v2.5.0, v2.5.0-beta1, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2] but these conflict with your requirements or minimum-stability.
    - doctrine/orm v2.5.2 requires doctrine/common >=2.5-dev,<2.6-dev -> satisfiable by doctrine/common[2.5.x-dev, v2.5.0, v2.5.0-beta1, v2.5.1, v2.5.2, v2.5.3] but these conflict with your requirements or minimum-stability.
    - doctrine/orm v2.5.1 requires doctrine/common >=2.5-dev,<2.6-dev -> satisfiable by doctrine/common[2.5.x-dev, v2.5.0, v2.5.0-beta1, v2.5.1, v2.5.2, v2.5.3] but these conflict with your requirements or minimum-stability.
    - doctrine/orm v2.5.0 requires doctrine/common >=2.5-dev,<2.6-dev -> satisfiable by doctrine/common[2.5.x-dev, v2.5.0, v2.5.0-beta1, v2.5.1, v2.5.2, v2.5.3] but these conflict with your requirements or minimum-stability.
    - doctrine/doctrine-orm-module 1.1.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - Installation request for mabuzagu/pdo-dblib-module dev-master -> satisfiable by mabuzagu/pdo-dblib-module[dev-master].

这是为什么呢?在我设置一些新版本之前,它现在可能不应该更新任何东西。

【问题讨论】:

删除 composer.lock 文件。 @Naktibalda 仅当代码覆盖率约为 100% 时,否则可能会有风险 【参考方案1】:

只要运行composer update

我做错了什么?

问题是您尝试更新单个包而不是更新整个包列表,这是 codeception 的较新版本所要求的。

正如您在错误消息中看到的,所有其他依赖项都急于更新,但它们是 locked,因为它们已经在 composer.lock 文件中指定了版本。

删除 .lock 文件可能会有所帮助,但不是“正确的方法”。只需明确告诉作曲家根据composer.json 更新所有内容。

P.S.您也可以考虑在将来在您提到的命令中使用composer clear-cache,以应对您绝对肯定希望从头开始下载和安装每个依赖项的情况。

【讨论】:

但问题是我的团队不想更新所有软件包,因为应用程序中可能会出现问题。我尽量尽可能地更新。但是我没有别的办法了吗?我可以尝试更新 codeception 所需的所有包,但我想避免更新不相关的包。 @Darius.V 这完全取决于您的composer.json 文件。如果您想冻结其他包的版本 - 只需在 composer.json 中指定确切的包版本,而不是使用通配符的灵活版本。然后composer update 根本不会尝试更新它们。曾经:-) 我想我可以从 composer show output ***.com/questions/15185459/…复制版本 @Darius.V 我建议在对版本进行任何更改之前复习versions in composer 以了解可接受的格式以及它的基本工作原理。至于来自.lock 文件的复制粘贴版本 - 是的,它应该可以工作,寻找紧随name 之后的包的version 属性。您没有任何dev-master 版本,因此不需要通过提交哈希指定版本。 但问题是一些包不在列表中,并试图显示一个版本,得到错误:“找不到包 zendframework/zend-crypt”【参考方案2】:

有两点:

    Composer 经常无法使用依赖项执行更新。

    Codeception 未绑定到您的项目。 (如果您没有故意这样做) 这可以让你做到:

    composer 移除 codeception/codeception

    +

    作曲家需要“codeception/codeception:2.2.7”

附言最近从 2.0 升级时遇到了同样的问题

【讨论】:

以上是关于Composer 更新 codeception - phpunit 不更新的主要内容,如果未能解决你的问题,请参考以下文章

codecept:找不到命令

如何在 Codeception 中使用 Stub::update?

为啥更新包时“composer.json”没有更新?

Codeception 全堆栈的 PHP 测试框架

Codeception:哪些测试组组合是可能的?

Symfony/Codeception 运行错误