composer问题集锦

技术库 小李 2357浏览
  • 切换镜像指向

  • composer config -g repos.packagist composer https://mirrors.tencent.com/composer/
    

    Composer 安装简明教程:

    一、下载:
    wget https://mirrors.tencent.com/composer/composer.phar
    
    二、安装:
    mv composer.phar  /usr/local/bin/composer
    

  • composer install 出错

[Composer\Downloader\TransportException]
Content-Length mismatch, received 143087 bytes out of the expected 1370814

使用国内的composer镜像

composer config -g repo.packagist composer https://packagist.phpcomposer.com

报错

Problem 1
- topthink/think-installer v1.0.12 requires composer-plugin-api ^1.0 -> foun
d composer-plugin-api[2.0.0] but it does not match the constraint.
- topthink/framework v5.0.21 requires topthink/think-installer ~1.0 -> satis
fiable by topthink/think-installer[v1.0.12].
- topthink/framework is locked to version v5.0.21 and an update of this pack
age was not requested.

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

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

需要用 composer 1 安装

composer self-update --1

安装 composer 1,若要安装 composer 2 可使用

composer self-update --2
项目目录下的composer.json文件中增加下面内容
{ "require": { "php-amqplib/php-amqplib": "2.7.*" //增加这行 }}
然后接着执行
composer update php-amqplib/php-amqplib

转载请注明:清韵逸-博客生活分享 » composer问题集锦