本文涉及环境情况如下
序号 | 环境名称 | 版本 |
---|---|---|
1 | Flarum | 1.8.5 |
2 | PHP | 8.2.10 |
3 | MYSQL | 8.2.0 |
报错如下:
/www/sites/flarum/index # composer require extiverse/mercury:*
./composer.json has been updated
Running composer update extiverse/mercury
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- extiverse/mercury[0.1.2, ..., 0.2.0] require extiverse/api-client ^0.2.1 -> satisfiable by extiverse/api-client[0.2.1, ..., 0.2.6].
- extiverse/mercury[0.1, ..., 0.1.1] require extiverse/api-client ^0.2 -> satisfiable by extiverse/api-client[0.2, ..., 0.2.6].
- extiverse/api-client[0.2, ..., 0.2.4] require guzzlehttp/guzzle 7.3.* -> found guzzlehttp/guzzle[7.3.0] but the package is fixed to 7.8.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- extiverse/api-client 0.2.5 requires guzzlehttp/guzzle 7.3.* || 7.4.* -> found guzzlehttp/guzzle[7.3.0, ..., 7.4.5] but the package is fixed to 7.8.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- extiverse/api-client 0.2.6 requires guzzlehttp/guzzle 7.3.* || 7.4.* || 7.5.* -> found guzzlehttp/guzzle[7.3.0, ..., 7.5.3] but the package is fixed to 7.8.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires extiverse/mercury * -> satisfiable by extiverse/mercury[0.1, ..., 0.2.0].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
解决方法
{% note warning flat %}
请备份所有数据再进行接下来的操作,此操作可能会导致网站不可用!
{% endnote %}
- 报错原因:主要问题是在安装过程中解决依赖关系。具体来说,
extiverse/mercury
包与你项目当前状态或相互之间存在依赖冲突。extiverse/mercury
需要extiverse/api-client
,而这个包在不同版本中对guzzlehttp/guzzle
包的要求不同。extiverse/api-client
的不同版本要求guzzlehttp/guzzle
的版本为7.3.*
、7.4.*
或7.5.*
,但你的项目当前固定在另一个版本的guzzlehttp/guzzle
(7.8.1)。这导致了冲突,因为 Composer 无法同时满足这些版本要求。
- 解决方案建议:Composer 建议使用
--with-all-dependencies
(-W
)选项。这个选项允许 Composer 尝试通过考虑当前特定版本锁定的包的更新、降级和移除来解决这些冲突。这意味着 Composer 将尝试调整所有依赖关系。 - 结果如图所示:
composer require extiverse/mercury:* -w
原文链接:
- 个人博客:John Tao的Blog