Today I was working with Composer for the Query Monitor plugin, and like I normally do I went to run “composer install”. Except this time, I got some unexpected results:
composer install Loading composer repositories with package information The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date Updating dependencies (including require-dev) [Composer\Downloader\TransportException] The "https://packagist.org/p/johnbillion/query-monitor%241ed527407df0c46370391d7a80d456bb7a0a22d579fa73cf4255137d00d1829e.json" file could not be downloaded: failed to open stream: Operation timed out install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
It’s worth noting the this is not a problem with Query Monitor, or even Composer itself. Clearly, the problem has to do with composer’s inability to download https://packagist.org/packages.json.
Being a technical person, the first thing I did was view packages.json in my browser, and I could see that it loaded almost immediately. Puzzling…
I ran composer with verbose debugging output, and after I didn’t find anything else useful, I decided that it would be best to simply follow the troubleshooting link provided in the initial output. If I was really better at troubleshooting, I would have just done that instead of using more verbose debugging, but oh well.
I read about Degraded Mode in the troubleshooting doc, but what really caught my attention was the Operation Timed Out (IPv6) section right beneath it. While the sample error message was for a different file download than my message, I realized it was possibly the same issue. Sure enough, I followed the instructions to temporarily disable IPv6 for my network connection, and “composer install” immediately worked after that.
While IPv6 still doesn’t have widespread adoption, the fact that it doesn’t work properly on Comcast (at least not as of this writing) is quite disappointing. While I could attempt to reach out to Comcast, I’m not their direct customer, since I work from an awesome co-working space, Work2gether. I don’t think it would be worth my time to attempt to reach out when I have a viable workaround.
Hopefully this helps someone else running into this same problem.