failed to open stream: operation failed
错误详细信息:
[ComposerDownloaderTransportException] 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
[ComposerDownloaderTransportException] Content-Length mismatch, received 3444 bytes out of the expected 299952
错误发生情境:
使用 composer require 命令下载软件时。
解决办法:
(1)更换composer镜像源,可以执行尝试以下几种:
更换成阿里镜像:composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
更换成Laravel China镜像: composer config -g repo.packagist composer https://packagist.laravel-china.org
更换成中国全量镜像:composer config -g repo.packagist composer https://packagist.phpcomposer.com
(2)如果更换镜像,还不能下载成功,可能是网络有问题:
1、(虚拟机环境)可以尝试把静态ip更换为动态获取,桥接改为网络地址转换。
2、通过ftp或文件共享方式下载然后上传。