composer報錯 failed to open stream: operation failed
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[Composer\Downloader\TransportException] The
“https://packagist.laravel-china.org/p/alibabacloud/client%242af159d2c938f36152d6b20322723c27286f3fbae7170b960d
b728b9a5915df8.json” file could not be downloaded: Peer certificate
CN=*.phphub.org' did not match expected CN=
pa
ckagist.laravel-china.org’ Failed to enable crypto failed to open
stream: operation failed
解決方案:
方法一: 修改 composer 的全局配置文件(推薦方式)
打開命令行窗口(windows用戶)或控制檯(Linux、Mac 用戶)並執行如下命令:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
方法二: 修改當前項目的 composer.json 配置文件:
打開命令行窗口(windows用戶)或控制檯(Linux、Mac 用戶),進入你的項目的根目錄(也就是 composer.json 文件所在目錄),執行如下命令:
composer config repo.packagist composer https://packagist.phpcomposer.com