php - 更新到 composer 2.0 后 TravisCI 版本矩阵出现问题
问题描述
更新到 Composer 2.0 后,我在做 Travis 时遇到了问题。
我有一个 TYPO3 扩展,我想用多个 TYPO3 版本进行测试。直到昨天我才能做到这一点composer require nimut/typo3-complete:$TYPO3_VERSION
(来自版本 Matrix)。
更新后,我收到以下错误/信息。
Cannot update only a partial set of packages without a lock file present.
Installation failed, reverting ./composer.json to its original content.
由于我的存储库中没有 composer.lock,我composer install
首先测试了我的管道,然后进行了更新。这一切都很好,直到我进入下一个版本,因为依赖项不同,并且来自的 composer.lockcomposer install
无法更新其他依赖项。
我已经尝试过composer require --dev nimut/typo3-complete:^10.4 --with-all-dependencies
作曲家的回应:
Problem 1
- typo3/testing-framework is locked to version 4.15.2 and an update of this package was not requested.
- typo3/testing-framework 4.15.2 requires typo3/cms-backend ^9.3 -> found typo3/cms-backend[v9.3.0, ..., 9.5.x-dev] but it conflicts with another require.
Problem 2
- symfony/http-client v5.1.7 requires symfony/http-client-contracts ^2.2 -> found symfony/http-client-contracts[dev-main, dev-master, v2.2.0, v2.3.1, 2.3.x-dev (alias of dev-master)] but it conflicts with another require.
- nunomaduro/phpinsights v1.14.0 requires sensiolabs/security-checker ^6.0 -> satisfiable by sensiolabs/security-checker[v6.0.3].
- sensiolabs/security-checker v6.0.3 requires symfony/http-client ^4.3|^5.0 -> satisfiable by symfony/http-client[v5.1.7].
- nunomaduro/phpinsights is locked to version v1.14.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
该-W
选项是我已经在尝试的选项。我都试过了-w
,-W
到目前为止还没有运气。
我不确定如何解决这个问题,您的输入对您很有帮助。
链接到.travis.yml
https://github.com/AOEpeople/crawler/blob/master/.travis.yml#L50
链接到 Travis Build 进行测试。 https://travis-ci.org/github/AOEpeople/crawler/jobs/738603105#L1138
解决方案
在 Composer 的 GitHub 存储库上的PR 9336composer require
中报告并修复了该问题。它将在即将发布的 Composer 2.0.2 中。因此,您可以升级到 2.0.2,它应该可以解决您的问题。
要解释您的解决方法失败的原因:
composer require nimut/typo3-complete:$TYPO3_VERSION
编辑 composer.json 文件以添加"nimut/typo3-complete": "^$TYPO3_VERSION"
. 然后它运行composer update nimut/typo3-complete
,或者(在 Composer 1.x 或 2.0.2+ 上)一个普通的composer update
,如果还没有锁文件存在的话。
如果您首先运行composer install
没有锁定文件的 a,这将执行 a,composer update
因为没有锁定文件。随后的composer require
then 仍然编辑 json 文件,现在运行composer update nimut/typo3-complete
,因为有一个 lock 文件。composer update
即使启用了所有依赖项选项,由于您将更新限制为仅新包及其依赖项,因此运行普通程序可能会产生不同的结果甚至冲突。
推荐阅读
- css - Safari 上的 snap 滚动容器内的线性滚动
- rust - 我可以在结构体内部调用宏吗?
- flutter - Dart 中线程、隔离和进程的区别
- excel - 多平台 Windows 和 MAC 计算机识别
- netsuite - customer.copy : 请输入值: 客户 ID 异常被抛出
- java - 获取 NoClassDefFoundError:无法初始化类 org.codehaus.groovy.vmplugin.v7.Java7
- sql - 如何在 Data Studio BigQuery 社区连接器的 SQL 查询中包含日期范围
- if-statement - if 语句和 Pascal 中的最大值
- ubuntu - 错误:模块“平台”没有属性“linux_distribution”
- r - 如何在 for 循环中在 Shiny 中打印 ggplots 列表