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 

原文链接:https://blog.csdn.net/weixin_38375151/article/details/102400379

posted @ 2022-12-16 20:58  Lafite-1820  阅读(235)  评论(0编辑  收藏  举报