如何解决“只能安装以下产品之一”:冲突? [英] How to resolve a "Can only install one of:" conflict?

查看:125
本文介绍了如何解决“只能安装以下产品之一”:冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过Composer安装了一个软件包,并且由于该软件包,它也安装了Guzzlehttp。
之后,我尝试通过Composer安装另一个软件包,这也需要Guzzlehttp,而Composer尝试再次安装它。

I have installed one package via Composer and it installed Guzzlehttp too, because of the package. After that I tried to install another package via Composer, which requires Guzzlehttp too and Composer, tried to install it again.

但是我得到了这个错误:

But I get that error :


问题1

Problem 1


  • 只能安装以下之一:guzzlehttp / guzzle [6.2.0, 6.0.2]。

  • Can only install one of: guzzlehttp/guzzle[6.2.0, 6.0.2].

只能安装以下之一:guzzlehttp / guzzle [6.0.2,6.2.0]。

Can only install one of: guzzlehttp/guzzle[6.0.2, 6.2.0].

只能安装以下之一:guzzlehttp / guzzle [6.0.2,6.2.0]。

Can only install one of: guzzlehttp/guzzle[6.0.2, 6.2.0].

我明白是什么问题,但我不知道如何解决。

I see what is the problem, but I do not know how to fix it.

推荐答案

当两个不同的程序包指向相同的依赖项,但相互不同的专业时,会出现 只能安装一个[x,y] 消息。独家版本,只能安装一个。

The "Can only install one [x, y]" message appears when two different packages point to the same dependency, but different major, mutually exclusive versions where only one can be installed.

例如,由于您的 composer.lo中存在信息,因此可以将一个版本 锁定在 ck 文件可能与您要安装的文件冲突。在这种情况下,当出现错误消息 锁定在xyz 时,您可以使用以下命令来了解已安装软件包的现有依赖项:

For example, one version can be "locked at" due to the information present in your composer.lock file which may conflict with what you're trying to install. In this case, when the confusion error comes with "locked at x.y.z" message, you may use the following commands to understand the existing dependencies of installed packages:

composer show -t

注: -t 显示为嵌套树视图,将其拖放以查看平面列表。

Note: -t shows as a nested tree view, drop it to see the flat list.

要查看项目中从哪里引用有问题的软件包,请运行:

To see where the problematic package is referenced from in your project, run:

composer why org/package -t

注意: -t 显示为嵌套树

Note: -t shows as a nested tree view, drop it to see the flat list.

要查看要安装的软件包的详细信息,可以运行:

To see the details of the package which you're trying to install, you may run:

composer show -a org/package # Package to inspect.

注意:要检查特定版本,请添加 xyz ,例如: composer show -a guzzlehttp / guzzle 6.2.0

Note: To inspect the specific version, add x.y.z, e.g.: composer show -a guzzlehttp/guzzle 6.2.0

要进一步解决该问题,具体取决于您的情况,您可以尝试:

To further troubleshoot the problem, depending on your situation, you can try to:


  • 通过以下方式更新具有依赖性的现有软件包:

  • Update the existing packages with dependencies via:

composer update --with-dependencies


  • 从您的 composer.json 升级或删除有冲突的依赖项(保持简单) )。

  • Upgrade or remove conflicting dependencies from your composer.json (keep it simple).

    这篇关于如何解决“只能安装以下产品之一”:冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆