Saani
Saani

Reputation: 782

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

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: enter image description here

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?

Upvotes: 12

Views: 40775

Answers (6)

Stephen Adelakun
Stephen Adelakun

Reputation: 804

For me, on my Windows machine, I was installing phpmailer; So, I mistakenly wrote

composer require phpmailer\phpmailer 

instead of

composer require phpmailer/phpmailer

I just thought somebody may have made that same silly mistake I made. So please use forward slash instead of backslash.

Upvotes: 0

Herr Nentu'
Herr Nentu'

Reputation: 1506

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.

Upvotes: 2

Parth Kharecha
Parth Kharecha

Reputation: 6503

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)

Upvotes: 0

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

Upvotes: 15

TheTC
TheTC

Reputation: 697

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.

Upvotes: 5

André Schild
André Schild

Reputation: 4754

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

Upvotes: 6

Related Questions