我正在使用Windows 10,并且已安装composer
。当我尝试使用以下命令全局安装laravel
安装程序时:
composer global require laravel/installer
[Composer\Downloader\TransportException]
The "https://repo.packagist.org/packages.json" file could not be downloaded:
failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
这意味着未下载软件包。我没有使用任何代理服务器。 作曲家的诊断结果如下:
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist:
[Composer\Downloader\TransportException] The "http://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Checking https connectivity to packagist:
[Composer\Downloader\TransportException] The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
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: A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection failed
because connected host has failed to respond.
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952 OK
Checking composer version: OK
Composer version: 1.8.0
PHP version: 7.2.1
PHP binary path: E:\xampp\php\php.exe
答案 0 :(得分:2)
您使用任何防病毒软件吗? 如果是,请尝试禁用然后检查。
有时Mcafe禁止下载packagist。
答案 1 :(得分:1)
要解决此问题,请在安装Laravel之前,在cli 上运行以下命令,将composer配置为使用 https 存储库
composer config -g repo.packagist composer https://packagist.org
答案 2 :(得分:0)
以下步骤将解决Composer的大多数“无法下载packages.json文件”问题:
注意:修改php.ini文件时,请确保使用正确的PHP版本和环境(Apache,CLI等)。
答案 3 :(得分:0)
我相信您面临着与this相同的问题,并且 this。 Composer建议以下内容:
我们建议您修复IPv6设置。如果不可能,则可以尝试以下解决方法:
遗憾的是,对于Windows解决方法,它说,如果无法解决您的设置或不能解决问题,则应彻底禁用IPv6,这是一个常见的答案,建议您使用here(但是视频已被删除,所以我在这篇文章中提供了可靠的答案)。
(我故意将窗口对齐,以便您可以看到屏幕上的步骤)
编辑#1
建议here是:
如果需要有效地更改IP,请安装Windows级别的VPN或代理交换机,作为默认路由。尝试CyberGhost
这似乎可以解决OP的问题。
答案 4 :(得分:0)
我注意到在更改网络(例如从办公室到办公室移动)时,这种情况也在发生。 我设法解决的方法是重新启动Docker容器。 我已经发生过2次这种情况,并且相同的解决方案有所帮助。
答案 5 :(得分:0)
您需要做的就是以管理员身份运行您的 cmd/git,无需卸载任何东西。