且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Composer更新成功,但是在创建的锁定文件上Composer安装失败

更新时间:2023-11-04 18:08:16

TL; DR;



您要解决的方法是删除行

TL;DR;

Your way to fix it is to drop the line

"symfony/templating": "^4.1",

从您的 composer.json ,然后重试整个过程。

From your composer.json, and retry the whole thing.

请记住,它将把您的 symfony / templing 版本降级到 3.4.x 并可能导致副作用。

Mind that it will downgrade your symfony/templating version to 3.4.x and might cause you side effects.

为什么? 好吧,您的问题实际上出在这里:symfony / symfony的composer.json行:> https://github.com/symfony/symfony/blob/3.4/composer.json#L77

Why? Well, your issue is actually coming from here: that line of the composer.json of symfony/symfony: https://github.com/symfony/symfony/blob/3.4/composer.json#L77

并由 https://getcomposer.org/doc/04-schema.md#replace

事实上,当您安装 symfony / symfony 时,在相同版本中替换 symfony / tempulation (因此,在您的情况下为 3.4.30 ),但随后,您在 composer.json 中也有说明,以将其安装为版本 ^ 4.3

So, as a matter of fact, when you install symfony/symfony, it acts as a replacement of symfony/templating at the same version (so 3.4.30, in your case) but then, you also have the instruction in your composer.json to install it at the version ^4.3

这些行也告诉您:

- don't install symfony/symfony v3.4.30|remove symfony/templating v4.3.3
- don't install symfony/templating v4.3.3|don't install symfony/symfony v3.4.30

它实际上指示您安装 symfony / symfony v3.4.30 symfony /模板v4。 3.3 但不能同时使用,因为 replace 指令> package使它与 symfony / templating 完全相同,但在您的情况下,不是同一版本。

It actually instruct you to either install symfony/symfony v3.4.30 OR symfony/templating v4.3.3 but not both at the same time, because the replace instruction of the symfony/symfony package make it the exact same package as symfony/templating, but not in the same version in your case.

实际上,作曲家的文档也确实告诉您:

And actually the composer documentation tells you exactly that too:


这对于包含子软件包(对于$ b $)的软件包也很有用。 b示例中,主要的symfony / symfony软件包包含所有Symfony
组件,这些组件也可以作为单独的软件包使用。如果您
需要主软件包,它将自动满足单个组件之一的任何要求
,因为它将替换它们。

This is also useful for packages that contain sub-packages, for example the main symfony/symfony package contains all the Symfony Components which are also available as individual packages. If you require the main package it will automatically fulfill any requirement of one of the individual components, since it replaces them.

来源: https:// getcomposer。 org / doc / 04-schema.md#replace