我有一个通过作曲家安装的包需要guzzlehttp >=6.0
。根据该要求,composer选择安装6.2.1。
我现在正在尝试要求明确要求6.1.1的依赖项。
我收到以下错误:
Problem 1
- Can only install one of: guzzlehttp/guzzle[6.1.1, 6.2.1].
- Can only install one of: guzzlehttp/guzzle[6.2.1, 6.1.1].
- Can only install one of: guzzlehttp/guzzle[6.1.1, 6.2.1].
- chargely/chargify-sdk-php v0.1.1 requires guzzlehttp/guzzle 6.1.1 -> satisfiable by guzzlehttp/guzzle[6.1.1].
- Installation request for chargely/chargify-sdk-php ^0.1.1 -> satisfiable by chargely/chargify-sdk-php[v0.1.1].
- Installation request for guzzlehttp/guzzle (locked at 6.2.1) -> satisfiable by guzzlehttp/guzzle[6.2.1].
此外,composer why
确认只有那个版本的guzzle是因为我的>=6.0
要求。
理论上,使用降级版本的guzzle,初始要求应该没问题。我如何让作曲家去做呢?
答案 0 :(得分:4)
如果您有2个包含并发要求的软件包,则可以使用别名。
在composer.json
中,只需添加:
"require": {
"guzzlehttp/guzzle": "6.2 as 6.1"
}
然后使用composer require ...
添加新包。
请查看more detailed answer了解更多信息。
答案 1 :(得分:0)
只需“要求”正确版本的依赖项,添加新包,然后删除硬编码的版本约束。
摘要(对于具有供应商/依赖项约束的 vendor/current
:“^1.0|^2.0”)
composer require vendor/dependency:^1.0
composer require vendor/new
composer remove vendor/dependency
例如
vendor/current
的 vendor/dependency:"^1.0|^2.0"
vendor/dependency:2.x
vendor/new
=> FAIL 约束的 vendor/dependency:"^1.0"
(因为您已经安装了过高的供应商/依赖项(2.0)composer require vendor/dependency:^1.0
composer require vendor/new
composer remove vendor/dependency
中的硬编码约束