无法下载“https://packagist.org/packages.json”文件

Posted

技术标签:

【中文标题】无法下载“https://packagist.org/packages.json”文件【英文标题】:The "https://packagist.org/packages.json" file could not be downloaded 【发布时间】:2019-05-19 01:52:47 【问题描述】:

我想为我正在制作的 Laravel 聊天应用安装一个包。运行“composer require foo/bar”时,终端出现以下错误:

In RemoteFilesystem.php line 515:

The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Unable to find the socket transport "proxy_user_name" - did you forget to enable it when you configured PHP?

我正在使用 ***,但它仍然指的是我的代理凭据,由于 ***,我应该看不到它。

当运行“作曲家诊断”时,我得到了这个:

Lolo@lolo:/media/lolo/project_path/project_name$ 
composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: WARNING

[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: Unable to find the socket transport "foobar" - did you forget to enable it when you configured PHP?

Checking https connectivity to packagist: WARNING
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Unable to find the socket transport "foobar" - did you forget to enable it when you configured PHP?

Checking HTTP proxy: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Unable to find the socket transport "foobar" - did you forget to enable it when you configured PHP?

Checking HTTP proxy support for request_fulluri: WARNING
Unable to assess the situation, maybe packagist.org is down (The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: Unable to find the socket transport "foobar" - did you forget to enable it when you configured PHP?)

Checking HTTPS proxy support for request_fulluri: WARNING

Unable to assess the situation, maybe github is down (The "https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0" file could not be downloaded: failed to open stream: Unable to find the socket transport "foobar" - did you forget to enable it when you configured PHP?)
Checking github.com rate limit: FAIL

[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: failed to open stream: Unable to find the socket transport "foobar" - did you forget to enable it when you configured PHP?

Checking disk free space: OK
Composer version: 1.6.3
PHP version: 7.2.7-0ubuntu0.18.04.2
PHP binary path: /usr/bin/php7.2

什么可能导致错误?

【问题讨论】:

【参考方案1】:

这是由于代理配置错误。尝试更正您的代理或使用

(暂时)禁用它
unset http_proxy;
unset https_proxy;

当需要通过代理时,您可以使用 redsocks。

【讨论】:

以上是关于无法下载“https://packagist.org/packages.json”文件的主要内容,如果未能解决你的问题,请参考以下文章

无法下载检测到病毒

PDF下载无法打开

苹果手机下载东西,老是显示无法下载app。。请问这是怎么回事

下载管理器无法下载 APK

安卓手机无法下载软件

为啥油管mkv格式无法下载