Question

I'm trying to update composer but it gives below error.

root@magento-2:/var/www/html/magento# composer clear-cache
root@magento-2:/var/www/html/magento# composer diagnose
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Checking composer.json: WARNING
The version field is present, it is recommended to leave it out if the package is published on Packagist.
Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance
require.magento/product-community-edition : exact version constraints (2.1.3) should be avoided if the package follows semantic versioning
require.composer/composer : unbound version constraints (@alpha) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: WARNING
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
OK
Checking composer version: OK

I also visited https://getcomposer.org/doc/articles/troubleshooting.md & SO

Was it helpful?

Solution

The issue has been reported here: https://github.com/composer/composer/issues/4247

In addition to that, following will solve the issue:

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top