沃梦达 / 编程问答 / php问题 / 正文

我将如何只更新一个作曲家依赖项?

How would I only update one composer dependency?(我将如何只更新一个作曲家依赖项?)

本文介绍了我将如何只更新一个作曲家依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我预料到了

composer update videlalvaro/php-amqplib

只会更新一个依赖项,但不会更新所有依赖项.

would only update one dependency, but instead of that it updates all.

我错过了什么?

PS:这个依赖在composer.json

PPS:使用的作曲家版本是3da05c68f9561fa822c522b1815435ff990493ff 2013-10-02 14:25:06

PPS: the composer version used is 3da05c68f9561fa822c522b1815435ff990493ff 2013-10-02 14:25:06

PPPS:实际输出:

$ composer.phar update videlalvaro/php-amqplib --no-dev
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - Installation request for symfony/icu == 1.2.0.0 -> satisfiable by symfony/icu[v1.2.0].

推荐答案

命令 composer update videlalvaro/php-amqplib 只是更新该依赖项.但是它不会禁用 Composer 所做的其他依赖项检查.

The command composer update videlalvaro/php-amqplib does just update that dependency. However it doesn't disable the other dependency checking that Composer does.

错误消息抱怨的是 lib-icu 在您的系统上不可用.显然这可以通过安装 PHP Intl 扩展来解决.

What the error message is complaining about is that the lib-icu is not available on your system. Apparently this would be solved by installing the PHP Intl extension.

如果您在其中一个要求中需要 PHP 5.5 的项目执行 composer update,降级到 PHP 5.4,然后在另一个不需要 PHP 5.5 的要求上运行 composer update,您会看到类似的问题.即使您不会更新需要 PHP 5.5 的需求,该包的需求也无法解析,因此 Composer 会失败.

You would see similar issues if you did a composer update on a project that required PHP 5.5 in one of it's requires, downgraded to PHP 5.4 and then ran composer update on a separate require, that didn't require PHP 5.5. Even though you wouldn't be updating the require that needs PHP 5.5, the requirements for that package would not be resolvable, and so Composer would fail.

在您的情况下,即使您只是尝试将 videlalvaro/php-amqplib 更新到最新版本,也无法满足 symfony/icu 的要求,因此作曲家更新失败.

In your case, even though you're just trying to update videlalvaro/php-amqplib to the latest version, the requirements for symfony/icu aren't met, and so the composer update fails.

编辑

为了提供帮助,我猜您在上次更新后重新安装了 PHP,并且删除或忘记安装 PHP Intl 扩展.Composer 无法令人满意地满足您的 composer.json 设置的要求,因此默认不做任何事情,而不是故意在不满足要求的情况下进行更新.

To try to be helpful, I'm guessing you re-installed PHP since you last did an update, and either removed or forgot to install the PHP Intl extension. Composer can't satisfactorily satisfy the requirements your composer.json is setting, and so is defaulting to doing nothing, rather than knowingly doing an update where the requirements aren't met.

所以基本上,您需要安装运行现有已安装软件所需的 PHP 扩展,然后 Composer 将能够更新您要更新的单个包,以及满足其他包的要求.

So basically, you need to install the PHP extensions that are required for your existing installed software to run, and then Composer will be able to update the single package you want to update, as well as meet the requirements for the other packages.

这篇关于我将如何只更新一个作曲家依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:我将如何只更新一个作曲家依赖项?

基础教程推荐