gpt4 book ai didi

php - Composer require 安装包失败

转载 作者:行者123 更新时间:2023-12-04 02:04:30 25 4
gpt4 key购买 nike

我有一个 composer 项目需要主项目 composer.json 文件中的 vendor/package-1,vendor/package-1 需要 package-1 的 composer.json 中的 vendor/package-2。我目前安装了 vendor/package-1 的 1.18.11 版和 vendor/package-2 的 2.3.2 版。我想更新到新的 vendor/package-1 版本 1.19.*(需要来自 vendor/package-2 的版本 2.4.*)并执行:

composer require vendor/package-1:1.19.*

失败,我得到的输出是

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
- vendor/package-1 v1.19.2 requires vendor/package2 2.4.* -> satisfiable by vendor/package2[v2.4.3, v2.4.0, v2.4.1, v2.4.2].
- vendor/package-1 v1.19.1 requires vendor/package2 2.4.* -> satisfiable by vendor/package2[v2.4.3, v2.4.0, v2.4.1, v2.4.2].
- vendor/package-1 v1.19.2 requires vendor/package2 2.4.* -> satisfiable by vendor/package2[v2.4.3, v2.4.0, v2.4.1, v2.4.2].
- Can only install one of: vendor/package2[v2.3.2, v2.4.3].
- Can only install one of: vendor/package2[v2.4.0, v2.3.2].
- Can only install one of: vendor/package2[v2.4.1, v2.3.2].
- Can only install one of: vendor/package2[v2.4.2, v2.3.2].
- Can only install one of: vendor/package2[v2.4.3, v2.3.2].
- Installation request for vendor/package2 == 2.3.2.0 -> satisfiable by vendor/package2[v2.3.2].
- Installation request for vendor/package-1 1.19.* -> satisfiable by vendor/package-1[v1.19.1, v1.19.2].

Installation failed, reverting ./composer.json to its original content.

是否需要为所有依赖项指定 composer require 命令?如果我尝试

composer require vendor/package-1:1.19.* vendor/package-2:2.4.*

它可以工作,但不需要指定每个依赖项,对吧?

最佳答案

似乎 vendor/package2 在固定版本 2.3.2 或 2.3.* 中是必需的,无法更新到 2.4。

通常您应该尝试放宽版本要求以允许兼容更新。为此使用波浪号运算符,要求 package2 为 ~2.3(最低 2.3,只要它不是不兼容的版本 3 就更新)。这同样适用于 package1:如果您需要 1.19 行中包含的功能,则需要 ~1.19。

关于php - Composer require 安装包失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27066226/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com