Composer outdated 显示 drupal/core 有更新的版本,但 composer update 显示 "nothing to update"

Composer outdated shows drupal/core has a newer version, but composer update says "nothing to update"

这类似于一年前未回答的问题。据说我有 drupal/core:

的更新
$ composer outdated "drupal/*"
drupal/core                     8.6.10       8.6.12       Drupal is an open source content ...

但是当我运行更新...

$ composer update drupal/core --with-dependencies
Dependency "asm89/stack-cors" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "composer/semver" is also a root requirement, but is not explicitly whitelisted. Ignoring.
[ ... ]
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

我正在尝试按照此处的说明通过 composer 更新 drupal 8:https://www.drupal.org/docs/8/update/update-core-via-composer

我今天在更新 Drupal 时遇到了同样的问题,以下过程帮助我解决了这个问题。

  • 运行 使用您尝试更新到的特定版本的 composer update 命令。在这种情况下,它将是 composer require drupal/core:8.6.12 --update-with-dependencies 如果存在阻止更新的问题,这应该会向您显示问题列表。在我的例子中,我尝试更新到版本 8.6.11 并输出以下内容。

Problem 1

. Installation request for drupal/core 8.6.11 -> satisfiable by drupal/core[8.6.11].

. Can only install one of: twig/twig[1.x-dev, v1.35.3].

. Can only install one of: twig/twig[v1.35.3, 1.x-dev].

. Can only install one of: twig/twig[1.x-dev, v1.35.3].

. drupal/core 8.6.11 requires twig/twig ^1.38.2 -> satisfiable by twig/twig[1.x-dev, v1.38.2].

. Conclusion: don't install twig/twig v1.38.2

. Installation request for twig/twig (locked at v1.35.3, required as ^1.35.0) -> satisfiable by twig/twig[v1.35.3].

  • 如果没有列出问题,请尝试清除作曲家缓存 composer clearcache,然后再次尝试更新命令。
  • 您也可以尝试 运行 why-not composer 命令,看看它是否突出了任何问题 composer why-not drupal/core:8.6.12

在我的例子中,问题是 8.6.12 所需的 twig 组件是 v1.38.2,但在 composer 文件中被限制在较低版本 1.35。我使用以下命令更新 twig 版本,这让我可以使用正常的更新过程更新到 Drupal 8.6.12。

composer require twig/twig:1.35.2

希望对您有所帮助。