问题摘要:
The "https://packagist.laravel-china.org/packages.json" file could not be downloaded
最近用Composer同步时一直失败,并出现下面的错误信息
D:\xampp\htdocs\qfsoft>composer require jasig/phpcas
The "https://packagist.laravel-china.org/packages.json" file could not be downloaded: Peer certifica
te 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 t
he local cache and may be out of date
[Composer\Downloader\TransportException]
The "https://packagist.laravel-china.org/p/jasig/phpcas%24bd745d7849ad47969d06f11deb742ebbf8bdb
96c9b07515d924fa78be61974b8.json" file could not be downloaded: Peer certificate CN=`*.phphub.o
rg' did not match expected CN=`packagist.laravel-china.org'
Failed to enable crypto
failed to open stream: operation failed
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no
-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-
platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|
--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
在搜索后,得到解决方法:
D:\xampp\htdocs\qfsoft>composer config repo.packagist composer https://packagist.phpcomposer.com
在该目录下执行此命令即可。
上述参考文章:https://blog.csdn.net/myhuashengmi/article/details/53414260