【问题标题】:Getting error while installing laravel installer in window 10在窗口 10 中安装 laravel 安装程序时出错
【发布时间】:2019-05-27 21:37:49
【问题描述】:

我使用的是 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.

这意味着包没有下载。我没有使用任何代理服务器。 Composer诊断结果如下:

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

【问题讨论】:

  • 可能是网络问题。您是否尝试过使用不同的互联网连接?
  • 是的,我已经尝试了 3-4 个网络,当我将另一个系统与这些网络连接时,它工作正常。
  • 既然可以使用 laragon,为什么还要手动安装呢? (laragon.org)
  • 您可以在浏览器中打开链接 (https://repo.packagist.org/packages.json) 吗?
  • 嗨,安迪,我不知道 laragon。

标签: php composer-php laravel-5.5


【解决方案1】:

要解决此问题,请在安装 Laravel 之前在 cli 上运行以下命令,将 composer 配置为使用 https 存储库

composer config -g repo.packagist composer https://packagist.org

【讨论】:

【解决方案2】:

您使用任何防病毒软件吗? 如果是,请尝试禁用然后检查。

Mcafe 有时会阻止下载 packagegist。

【讨论】:

  • 我正在使用 Mcafe 防病毒软件。
  • 禁用它并重新启动计算机并检查。
  • 是的,卸载后一切正常。谢谢
【解决方案3】:

以下步骤将修复 Composer 的大多数“packages.json 文件无法下载”问题:

  1. 验证您的防火墙设置。为初学者禁用防火墙
  2. 启用 PHP OpenSSL 扩展
  3. 启用 PHP allow_url_fopen 指令

注意:确保在修改 php.ini 文件时使用正确的 PHP 版本和环境(apache、CLI 等)。

【讨论】:

  • 嗨 Solomon,我正在使用带有 XAMPP 和 php 7.2 版本的 window 10 64bit。我还尝试使用 php 7.3 和 window 不连接第三方软件,如 teamviewer。 1. Window 防火墙禁用 2. openssl 启用 3. 启用 php allow_url_fopen
  • 嗨,Gurpal,出于某种原因,我错过了您的评论。我相信您遇到的问题与 TeamViewer 劫持端口 80 和 443 有关。按照此答案的说明解决问题:serverfault.com/a/356117 我知道已经有一段时间了,您不需要这个答案。希望它可以帮助其他人。
【解决方案4】:

我相信您面临与this 相同的问题,并且 this。 Composer 推荐以下内容:

我们建议您修复 IPv6 设置。如果这不可行,您可以尝试以下解决方法:

遗憾的是,对于 Windows 解决方法,它说如果您的设置无法修复或者如果这没有解决问题,那么您应该彻底禁用 IPv6,这是一个常见的答案,也建议 here(但是视频有已被删除,所以我发布了这篇文章以获得可靠的答案)。

(我特意将窗口对齐,以便您可以看到屏幕上的步骤)

  • 打开控制面板
  • 导航到网络和互联网
  • 点击网络和共享中心
  • 在窗口左侧单击更改适配器设置
  • 找到您的适配器并右键单击它打开属性
  • 找到Internet 协议版本 6 (TCP/IPv6) 并取消选中它
  • 点击确定

编辑#1

here 的建议是:

如果您需要(有效地)更改 IP,请安装充当默认路由的 Windows 级 VPN 或代理切换器。试试 Cyber​​Ghost

这似乎解决了 OP 的问题。

【讨论】:

  • 我已经阅读了互联网上有关 composer 和 ipv6 的内容。没有一个它可以工作
  • 你的意思是我需要连接VPN
  • @Gurpalsingh 是的,试试 VPN。
  • 我已经尝试过使用 different-2 VPN。还尝试了不同的 2 网络。但每次它都会给出同样的错误
【解决方案5】:

我注意到在更改网络时也会发生这种情况(例如,从一个办公室搬到另一个办公室)。 我设法解决它的方法是重新启动 docker 容器。 这种情况我已经发生了 2 次,同样的解决方案也有帮助。

【讨论】:

    【解决方案6】:

    您只需以管理员身份运行 cmd/git,无需卸载任何东西。

    【讨论】:

      猜你喜欢
      • 2017-01-26
      • 1970-01-01
      • 2017-11-28
      • 1970-01-01
      • 2023-04-01
      • 2019-05-12
      • 2015-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多