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

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

问题描述

我已经通过 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.

但我得到了那个错误:

问题 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.lock 文件中的信息可能与您尝试安装的内容冲突,一个版本可能会锁定于".在这种情况下,当混淆错误带有locked at x.y.z"消息时,您可以使用以下命令来了解已安装包的现有依赖项:

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

要进一步解决问题,根据您的情况,您可以尝试:

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天全站免登陆