1. 程式人生 > >The "https://packagist.laravel-china.org/packages.json" file could not be downloaded:

The "https://packagist.laravel-china.org/packages.json" file could not be downloaded:

使用composer安裝錯誤提示:

The "https://packagist.laravel-china.org/packages.json" file could not be downloaded: Peer certificate CN=*.phphub.org' did not match expected CN=packagist.laravel-china.org'
Failed to enable crypto
failed to open stream: operation failed
https://packagist.laravel-china.org could not be fully loaded, package information was loaded from the local cache and may be out of date

按說明是映象地址請求出錯,於是去https://packagist.laravel-china.org檢視,發現Laravel China在一個月前發了篇文章《Laravel China 映象完成歷史使命,將於兩個月後停用》,所以很明白了,你需要換映象。

阿里雲 Composer 全量映象

Packagist 官方實時同步,推薦使用最新的 Composer 版本。

  • 映象型別:全量映象
  • 更新時間:1 分鐘
  • 映象說明:阿里雲 CDN 加速,更新速度快,推薦使用

全域性配置(推薦)

所有專案都會使用該映象地址:

 

1

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

取消配置:

 

1

composer config -g --unset repos.packagist

專案配置

  • 僅修改當前工程配置,僅當前工程可使用該映象地址:composer config repo.packagist composer https://mirrors.aliyun.com/composer/
  • 取消配置:composer config --unset repos.packagist

除錯

  • composer 命令增加 -vvv 可輸出詳細的資訊,命令如下:composer -vvv require alibabaclo