I am having issues with running composer install.
Logs:
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2014.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2015.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-01.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-04.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-07.json from cache
Downloading http://packagist.org/p/provider-2016-10%24ff2e148d6088b4779c6a0a96d948316f2e5da8341e45a2e07a6aabde65c73083.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-2016-10.json into cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-archived.json from cache
Downloading http://packagist.org/p/provider-latest%2485bc3196c320b8dd31538cc3ea381ba83516264aa5dc96d8cd942cdbd287f0e1.json
Writing /home/vagrant/.cache/composer/repo/https---packagist.org/p-provider-latest.json into cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-shopblocks$lithium.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-composer$installers.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-swiftmailer$swiftmailer.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-robmorgan$phinx.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$config.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$console.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$yaml.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$filesystem.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$debug.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-symfony$polyfill-mbstring.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-psr$log.json from cache
Reading /home/vagrant/.cache/composer/repo/https---packagist.org/provider-vlucas$phpdotenv.json from cache
Downloading http://packagist.org/p/erusev/parsedown%24e19aeb29924b7dfa95273e6e875d6ea4f2687a734aa1cac64745392b37ea7b62.json
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Downloading http://packagist.org/p/erusev/parsedown%24e19aeb29924b7dfa95273e6e875d6ea4f2687a734aa1cac64745392b37ea7b62.json
Downloading http://packagist.org/p/erusev/parsedown%24e19aeb29924b7dfa95273e6e875d6ea4f2687a734aa1cac64745392b37ea7b62.json
Downloading http://packagist.org/p/erusev/parsedown%24e19aeb29924b7dfa95273e6e875d6ea4f2687a734aa1cac64745392b37ea7b62.json
[ErrorException]
zlib_decode(): data error
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:388
Composer\Util\ErrorHandler::handle() at n/a:n/a
zlib_decode() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:388
Composer\Util\RemoteFilesystem->get() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:101
Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:646
Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:332
Composer\Repository\ComposerRepository->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:204
Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:193
Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:271
Composer\DependencyResolver\RuleSetGenerator->whitelistFromJobs() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:324
Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php:214
Composer\DependencyResolver\Solver->solve() at phar:///usr/local/bin/composer/src/Composer/Installer.php:461
Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:216
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:135
Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:847
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:231
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:104
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
require() at /usr/local/bin/composer:24
The line that appears to be where the issue comes from is:
Downloading http://packagist.org/p/erusev/parsedown%24e19aeb29924b7dfa95273e6e875d6ea4f2687a734aa1cac64745392b37ea7b62.json
Which if you visit in the browser, causes a redirect from http to https.
I can fix this issue locally, by doing this:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{
"packagist": false
}
]
The problem is not the redirect which we don't do for Composer, but most likely it's rather that when downloading over http and not https, you have a proxy in the way that messes with the zlib traffic and causes it to fail there. Forcing https like you did makes sure that the proxy can't see what's going on nor mess with the traffic. Not much we can do about this unfortunately.
Can there be a flag to force https? Or at least prefer https, so it will upgrade to https, before falling down to http?
By redefining it like you do, you remove the flag we have in the default config that lets it downgrade to http.. So it won't do it anymore, no special flag needed.
The short way to do this is composer config --global repos.packagist composer https://packagist.org which overrides the default packagist repo in your user-wide config.
composer config --global repos.packagist composer https://packagist.org
Great. That'll do :)
Thanks.
By redefining it like you do, you remove the flag we have in the default config that lets it downgrade to http.
What would be the reason it wasn't using https in the first place be then?
Afaik there is no proxy in place.
This is one of 5 machines in the office, all connected via the same router.
The only difference is this machine is on Sierra, but since composer is within vagrant, (which all run Ubuntu 14.04), shouldn't make any difference.
They all use the same DNS servers (8.8.8.8, 8.8.4.4).
Since running the install on forced-https seems to work, if thats the default, why wouldn't it work if there was the fallback onto http
The default is to downgrade to http after the first request because the connections establish faster and we can establish the trustworthiness of the data using hashes so we don't need TLS anymore. Why it fails I don't know, but it is usually due to a corporate proxy or ISP doing weird things to the network.
Thank you Seldaek for the solution! Have been smashing my head against the monitor for an hour trying to get composer to work with our proxies.
Most helpful comment
By redefining it like you do, you remove the flag we have in the default config that lets it downgrade to http.. So it won't do it anymore, no special flag needed.
The short way to do this is
composer config --global repos.packagist composer https://packagist.orgwhich overrides the default packagist repo in your user-wide config.