在 window 10 中安装 laravel 安装程序时出错
Getting error while installing laravel installer in window 10
我正在使用 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
以下步骤将解决大多数 "packages.json file could not be downloaded" Composer 问题:
- 验证您的防火墙设置。为初学者禁用防火墙
- 启用PHP OpenSSL 扩展
- 启用 PHP allow_url_fopen 指令
注意:确保您在修改 php.ini 文件时使用正确的 PHP 版本和环境(apache、CLI 等)。
我相信您面临着与 this 相同的问题并且
this。 Composer 推荐以下内容:
We recommend you fix your IPv6 setup. If that is not possible, you can try the following workarounds:
遗憾的是,对于 Windows 解决方法,它说如果您的设置无法修复或者如果这不能解决问题,那么您应该彻底禁用 IPv6,这是一个常见的答案,也被建议 here(但是视频已被删除所以我做了这个 post 以获得可靠的答案)。
(我特意将 windows 对齐,以便您可以看到屏幕上的步骤)
- 打开控制面板
- 导航至网络和 Internet
- 单击网络和共享中心
- 在 window 的左侧单击 更改适配器设置
- 找到您的适配器并右键单击它打开属性
- 找到 Internet 协议版本 6 (TCP/IPv6) 并取消选中它
- 单击确定
编辑#1
建议here是:
Install a Windows level VPN or proxy switcher that acts as the default route if you need to change your IP (effectively). Try CyberGhost
这似乎解决了 OP 的问题。
您使用任何杀毒软件吗?
如果是,请尝试禁用然后检查。
Mcafe 有时会阻止下载 packagist。
要解决此问题,请在安装 之前,通过 运行 在 cli 上执行以下命令,将 composer 配置为使用 https 存储库Laravel
composer config -g repo.packagist composer https://packagist.org
我注意到在更换网络时也会发生这种情况(例如从一个办公室搬到另一个办公室)。
我设法解决它的方法是重新启动 docker 容器。
这种情况我已经发生过 2 次了,同样的解决方案有所帮助。
您需要做的就是 运行 您的 cmd/git 管理员身份,无需卸载任何东西。
我正在使用 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
以下步骤将解决大多数 "packages.json file could not be downloaded" Composer 问题:
- 验证您的防火墙设置。为初学者禁用防火墙
- 启用PHP OpenSSL 扩展
- 启用 PHP allow_url_fopen 指令
注意:确保您在修改 php.ini 文件时使用正确的 PHP 版本和环境(apache、CLI 等)。
我相信您面临着与 this 相同的问题并且 this。 Composer 推荐以下内容:
We recommend you fix your IPv6 setup. If that is not possible, you can try the following workarounds:
遗憾的是,对于 Windows 解决方法,它说如果您的设置无法修复或者如果这不能解决问题,那么您应该彻底禁用 IPv6,这是一个常见的答案,也被建议 here(但是视频已被删除所以我做了这个 post 以获得可靠的答案)。
(我特意将 windows 对齐,以便您可以看到屏幕上的步骤)
- 打开控制面板
- 导航至网络和 Internet
- 单击网络和共享中心
- 在 window 的左侧单击 更改适配器设置
- 找到您的适配器并右键单击它打开属性
- 找到 Internet 协议版本 6 (TCP/IPv6) 并取消选中它
- 单击确定
编辑#1
建议here是:
Install a Windows level VPN or proxy switcher that acts as the default route if you need to change your IP (effectively). Try CyberGhost
这似乎解决了 OP 的问题。
您使用任何杀毒软件吗? 如果是,请尝试禁用然后检查。
Mcafe 有时会阻止下载 packagist。
要解决此问题,请在安装 之前,通过 运行 在 cli 上执行以下命令,将 composer 配置为使用 https 存储库Laravel
composer config -g repo.packagist composer https://packagist.org
我注意到在更换网络时也会发生这种情况(例如从一个办公室搬到另一个办公室)。 我设法解决它的方法是重新启动 docker 容器。 这种情况我已经发生过 2 次了,同样的解决方案有所帮助。
您需要做的就是 运行 您的 cmd/git 管理员身份,无需卸载任何东西。