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

梦想与她 提交于 2019-12-29 08:35:12

问题


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

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

But I am encountering the following problem:

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


回答1:


You need to tell composer to use a proxy.

Linke here: PHP Composer behind http proxy and Composer cannot download files

Like:

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



回答2:


Linux users can run this command to resolve this issue:

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

More Information




回答3:


The fix for me was found here: 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.




回答4:


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.




回答5:


For windows user open cmd and put this command

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


来源:https://stackoverflow.com/questions/31636294/https-packagist-org-packages-json-file-could-not-be-downloaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!