安装依赖项时composer-plugin-api错误

wel*_*elp 3 php symfony composer-php

我正在尝试为我正在处理的现有 Symfony 项目安装依赖项。我查看了这个https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file,它说我应该运行更新命令:php composer.phar update。我这样做了,但出现以下错误:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpro/grumphp[v0.12.0, ..., v0.12.1] require composer-plugin-api ~1.0 -> found composer-plugin-api[2.1.0] but it does not match the constraint.
    - Root composer.json requires phpro/grumphp ^0.12 -> satisfiable by phpro/grumphp[v0.12.0, v0.12.1].
Run Code Online (Sandbox Code Playgroud)

小智 6

似乎需要 Composer 1。尝试删除供应商文件夹并使用 降级 Composer composer self-update --1。比运行composer installcomposer update再次。