“锁定于"什么?< tag>运行"composer update< package>"时是什么意思? [英] What does "locked at" <tag> mean when running "composer update <package>"?

查看:48
本文介绍了“锁定于"什么?< tag>运行"composer update< package>"时是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行 composer更新< package> ,但出现以下错误:

I am trying to perform a composer update <package> but getting the following error:

请求的包< package>(锁定在< tag> ;,因为< version>)可以由< package> [< tag>]满足,但这些冲突符合您的要求或最低稳定性.

The requested package <package> (locked at <tag>, required as <version>) is satisfiable by <package>[<tag>] but these conflict with your requirements or minimum-stability.

同时,标记< tag> 仅作为字符串存在于我的composer.lock文件中,我认为该文件仅通过 composer update 进行了修改,无法回读

Meanwhile, the tag <tag> exists as a string only in my composer.lock file, which I thought was only modified by composer update, not read back.

我尝试运行 composer why-not< package> ,但是它的输出并不能真正解释问题:

I tried running composer why-not <package>, but its output didn't really explain the issue:

< program><其他版本>需要< package>(< version>)

<program> <other-version> requires <package> (<version>)

在这种情况下,锁定于"是什么意思,我该如何解决这个问题?

What does 'locked at' mean in this context and how do I solve the issue?

推荐答案

当您为 composer update 指定软件包名称(例如, composer update somevendor/somepackage )时,您告诉Composer您想更新该软件包,并将其他所有内容保留为当前版本-您要锁定"所有其他软件包,只需更新其中一个即可.

When you specify a package name to composer update (e.g. composer update somevendor/somepackage), you're telling Composer that you want to update that package and leave everything else at the current version - you want to "lock" all the other packages where they are, and just update one.

仅当您指定的软件包的新版本与那些已安装的软件包兼容时,该方法才起作用.如果新版本需要其他版本的新版本,或者列出了与之冲突"的列表,则该新版本不适用.特定版本,Composer只会告诉您它做不到.

That will only work if the new version of the package you specify is compatible with those already installed packages. If the new version requires a newer version of something else, or lists that it "conflicts with" a particular version, Composer will simply tell you that it can't do it.

其他程序包锁定在"的版本.都存储在 composer.lock 文件中,但是您永远不要手动编辑该文件.

The versions that the other packages are "locked at" are stored in the composer.lock file, but you should never edit that file by hand.

您可以通过几种方法告诉Composer允许更新哪些软件包:

You have a few ways to tell Composer which packages it's allowed to update:

  • 一次更新多个特定软件包以解决特定问题: composer更新somevendor/somepackage someelse/somedependency
  • 更新所选软件包及其所有依赖项除了您直接在composer.json中列出的那些软件包: composer更新somevendor/somepackage --with-dependencies
  • 更新所选软件包及其所有依赖项: composer更新somevendor/somepackage --with-all-dependencies
  • 只需更新所有内容: composer update 完全不带参数
  • Update more than one specific package at a time to resolve the specific problem: composer update somevendor/somepackage somethingelse/somedependency
  • Update the selected package and all its dependencies except the ones you've listed directly in your composer.json: composer update somevendor/somepackage --with-dependencies
  • Update the selected package and all its dependencies: composer update somevendor/somepackage --with-all-dependencies
  • Just update everything: composer update with no arguments at all

所有这些命令仍将遵守您在 composer.json 中手动指定的版本限制,您只是在命令行上向Composer additional 指令提供了有关可以更新哪些软件包来满足这些限制.

All of these commands will still respect the version constraints you've specified manually in composer.json, you are just giving Composer additional instructions on the command-line about which packages it's allowed to update to meet those constraints.

我个人建议只运行不带参数的 composer update :如果您想更严格地控​​制更新时间,则可以始终在 composer.json <中列出更具体的约束/code>.

Personally, I would advocate just running composer update with no arguments: if you want tighter control over when something gets updated, you can always list a more specific constraint in composer.json.

这篇关于“锁定于"什么?&lt; tag&gt;运行"composer update&lt; package&gt;"时是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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