为什么 Composer 在未指定时安装旧版本?

Why is Composer installing an old version when it isn't specified?

当我这样做时:

composer require deployer/deployer

我得到以下输出:

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.3 for deployer/deployer
./composer.json has been updated
Running composer update deployer/deployer
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - deployer/deployer[v4.3.0, ..., 4.x-dev] require monolog/monolog ^1.21 -> found monolog/monolog[1.21
.0, ..., 1.x-dev] but the package is fixed to 2.3.5 (lock file version) by a partial update and that vers
ion does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires deployer/deployer ^4.3 -> satisfiable by deployer/deployer[v4.3.0, ...,
 4.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

deployer/deployer 不在项目的 composer.jsoncomposer.lock 中,所以可能需要相对较旧的软件包版本似乎不受任何支持我的 Laravel 8 项目中的其他包?

由于您使用的是 PHP 8,因此 4.3 是 deployer/deployer 的最新版本,composer 已确定它与您的 PHP 版本和最低稳定性要求兼容。

  • v7 还没有稳定版本,但是 it is the version you need to use with PHP 8.
    您可以将候选版本与 composer require deployer/deployer:^7.0@RC 一起使用,或者如果您在 composer.json 中设置了 "minimum-stability": "RC",那么 composer require deployer/deployer 应该安装它。

  • v6 需要 "php": "^7.2".
    根据 the composer manual.

    ,我认为这相当于 >=7.2 <8.0.0
  • v5 需要 "php": "~7.0"(意思是 >=7.0 <8.0

  • v4 需要 "php": ">=5.6.0"(意味着高于 5.6.0 的版本)
    这个旧版本是您获得的版本,因为由于我上面提到的限制,它是作曲家可以尝试安装的唯一版本。我不知道它是否真的兼容PHP 8,但我对此表示怀疑。