在进行PHP项目部署时,执行composer install -vvv命令,报错

Reading ./composer.json
Loading config file /root/.composer/config.json
Loading config file /root/.composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/usr/local/nginx/html/project_dir): git branch --no-color --no-abbrev -v
Loading config file /root/.composer/config.json
Loading config file /root/.composer/auth.json
Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.9.3 (2020-02-04 12:58:49) with PHP 7.4.1 on Linux / 3.10.0-1062.9.1.el7.x86_64
Reading ./composer.json
Loading config file /root/.composer/config.json
Loading config file /root/.composer/auth.json
Loading config file ./composer.json
Executing command (/usr/local/nginx/html/project_dir): git branch --no-color --no-abbrev -v
Loading config file /root/.composer/config.json
Loading config file /root/.composer/auth.json
Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading ./composer.json
Loading config file /root/.composer/config.json
Loading config file /root/.composer/auth.json
Loading config file ./composer.json
Executing command (/usr/local/nginx/html/project_dir): git branch --no-color --no-abbrev -v
Repository type is not registered: /usr/local/bin/composer

执行composer config -l -g查看原因

[repositories.packagist.org.type] /usr/local/bin/composer
[repositories.packagist.org.url] https://mirrors.aliyun.com/composer/

执行 composer config -g repo.packagist composer https://packagist.phpcomposer.com 进行修复

执行composer config -l -g查看

[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://packagist.phpcomposer.com
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐