Composer 降低版本方法

1. 问题: 使用Composer安装Magento2.3.2 出现下面问题

 sudo composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.2 magento232
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes 
Creating a "magento/project-community-edition=2.3.2" project at "./magento232"
Installing magento/project-community-edition (2.3.2)

 - Downloading magento/project-community-edition (2.3.2)
 - Installing magento/project-community-edition (2.3.2): Extracting archive
Created project in /www/wwwroot/mgt232.yshuq.com/magento232
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
    - Root composer.json requires magento/product-community-edition 2.3.2 -> satisfiable by magento/product-community-edition[2.3.2].
    - magento/product-community-edition 2.3.2 requires php ~7.1.3||~7.2.0 -> your php version (7.4.33) does not satisfy that requirement.
  Problem 2
    - Root composer.json requires magento/magento2-functional-testing-framework ~2.3.14 -> satisfiable by magento/magento2-functional-testing-framework[2.3.14].
    - magento/magento2-functional-testing-framework 2.3.14 requires php 7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0 -> your php version (7.4.33) does not satisfy that requirement.
  Problem 3
    - friendsofphp/php-cs-fixer[v2.13.0, ..., v2.13.3] require php ^5.6 || >=7.0 <7.3 -> your php version (7.4.33) does not satisfy that requirement.
    - Root composer.json requires friendsofphp/php-cs-fixer ~2.13.0 -> satisfiable by friendsofphp/php-cs-fixer[v2.13.0, v2.13.1, v2.13.2, v2.13.3]
安装M2.3.2 失败

问题描述:当前php版本是7.4 安装Magento2.3.2 不支持。

解决办法:降低php的版本到7.1 再执行安装,这个时候检查下composer版本

composer -v
Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.1.33, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.

问题描述:我的php版本已经是7.1了,但是composer2.3.0 不支持。

解决办法:需要将composer版本降低到2.2。由于我的php版本已经降低成了7.1 就无法操作composer降低命令操作。

composer -v
Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.1.33, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.
composer与php不兼容

解决办法: 只有将php版本切回到7.4降低了composer版本之后,在切换php的版本为7.1。

下面是php版本切回到7.4 后降低composer版本的命令

$ sudo composer self-update --2.2
Storing "2.2" as default update channel for the next self-update run.
Warning: You forced the install of 2.2.21 via --2.2, but 2.6.2 is the latest stable version. Updating to it via composer self-update --stable is recommended.
Upgrading to version 2.2.21 (2.2.x channel).
   
Use composer self-update --rollback to return to version 2.5.8
安装之后的composer版本

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用 * 标注