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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31636294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:33:26  来源:igfitidea点击:

"https://packagist.org/packages.json" file could not be downloaded

phpjsonlaravelcomposer-php

提问by Saani

I am trying to install a new laravel instance with the following command:

我正在尝试使用以下命令安装一个新的 Laravel 实例:

composer create-project laravel/larevel authii --prefer-dist

But I am encountering the following problem: enter image description here

但我遇到了以下问题: 在此处输入图片说明

My internet connection is on proxy server: 192.168.20.9:8080Moreover, I am on windows platform win8.1 x64and Xamppwith PHP 5.6.11, any help?

我的互联网连接在代理服务器上:192.168.20.9:8080此外,我在 Windows 平台上win8.1 x64XamppPHP 5.6.11什么帮助吗?

采纳答案by André Schild

You need to tell composer to use a proxy.

您需要告诉作曲家使用代理。

Linke here: PHP Composer behind http proxyand Composer cannot download files

此处链接:http 代理后面的 PHP ComposerComposer 无法下载文件

Like:

喜欢:

export HTTP_PROXY="http://my-corp-proxy.mcdonalds"
php composer.phar install

回答by Tharindu Wickramasinghe

Linux users can run this command to resolve this issue:

Linux 用户可以运行此命令来解决此问题:

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

More Information

更多信息

回答by TheTC

The fix for me was found here: https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-.

在这里找到了对我的修复:https: //getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-

I had to disable IPv6 on my network interfaces. After disabling that, composer worked fine.

我不得不在我的网络接口上禁用 IPv6。禁用后,作曲家工作正常。

回答by Herr Nentu'

I noticed that this also happens when changing the networks. If I put the comüputer to sleep and then continue connected to other networks this happens. So either restart the computer or your docker. Seems to work for me. Had the issue 2 times already.

我注意到在更改网络时也会发生这种情况。如果我让计算机进入睡眠状态,然后继续连接到其他网络,就会发生这种情况。因此,要么重新启动计算机,要么重新启动 docker。似乎对我有用。已经有2次问题了。

回答by Parth kharecha

For windows useropen cmd and put this command

对于 Windows 用户,打开 cmd 并输入此命令

set http_proxy= xxx.xxx.xxx.xxx:xxxx (YOUR_IP:PORT)
set https_proxy= xxx.xxx.xxx.xxx:xxxx (YOUR_IP:PORT)