How to downgrade or install a specific version of Composer?

I'm getting the following error in a project I'm setting up:

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.

I've started at a new company this week, just trying to get their projects installed and there doesn't seem to be a way to change my composer version on Windows. I'd rather not update all their packages as I'm not familiar with the projects yet and have no clue what kind of implications go into that.

179375 次浏览

假设有一个常规的作曲家安装,要回滚到版本1的作曲家,您只需执行:

composer self-update --1

当你想回到版本2时(在更新或删除不兼容的插件之后,你应该这样做) :

composer self-update --2

以上内容将带您了解两个主要版本中的任何一个的最新版本。

你也可以通过将版本号传递给 self-update来“更新”到一个特定的版本:

composer self-update 1.10.12
composer self-update 2.0.7

执行任何 self-update之后,可以指定 --rollback返回到以前安装的版本。

composer self-update
composer self-update --rollback

最后,如果你喜欢冒险,你可以通过执行以下命令来更新到预发布版本:

composer self-update --preview

如果您已经在系统上安装了作曲器。然后粘贴下面的代码,根据您的需要用特定的版本降低编写器版本的等级。

composer self-update 1.10.14

对于 ubuntu 系统,请使用以下命令

sudo -H composer self-update 1.10.14

只有两个命令对我有效。目前我有作曲家2.x.x,我有1.10. x。第一个命令将下载降级版本,然后第二个命令将回滚到1.x。X

  1. php composer self-update --1
  2. composer self-update --rollback

我在作曲家安装程序“ -1”和“ -2”中找到了一个标志。 I'm using this command inside of my Dockerfile:

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --1

可以使用以下代码更新特定版本

composer self-update 1.10.12
composer self-update 2.0.7

or

composer self-update --1 or 2

下面的命令用于更新编曲器的特定版本。

composer self-update [version no of composer]

使用 phar代替。

下载 composer.phar文件的特定版本: Https://getcomposer.org/download

将这个 phar 文件放在项目的根目录中,试图在其中运行作曲家 install/update/need

现在用 php composer.phar require代替 composer require