使用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 加速,更新速度快,推荐使用
全局配置(推荐)
所有项目都会使用该镜像地址:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
取消配置:
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 alibabacloud/sdk