4

I am trying to install laravel 5.1 dependencies using composer.

I have installed the latest version of composer that is:

Composer version 1.0-dev (a54f84f05f915c6d42bed94de0cdcb4406a4707b) 2015-10-13 13:09:04

But when i run composer install on project directory it gives me following message and hangs in there:

Loading composer repositories with package information
Installing dependencies (including require-dev)
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
Sven
  • 69,403
  • 10
  • 107
  • 109
Saad Mehmood
  • 691
  • 1
  • 7
  • 19
  • I'd say that reading the URL that was mentioned in the error message will help. What is written there now is in the answer below. If this still does not help you, explain your problem better in a new question. – Sven Oct 17 '15 at 14:25

2 Answers2

5

From composer documentation :

If you have been pointed to this page, you want to check a few things:

If you are using ESET antivirus, go in "Advanced Settings" and disable "HTTP-scanner" under "web access protection" If you are using IPv6, try disabling it. If that solves your issues, get in touch with your ISP or server host, the problem is not at the Packagist level but in the routing rules between you and Packagist (i.e. the internet at large). The best way to get these fixed is raise awareness to the network engineers that have the power to fix it.

To disable IPv6 on Linux, try using this command which appends a rule preferring IPv4 over IPv6 to your config:

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

If none of the above helped, please report the error.

Source: https://getcomposer.org/doc/articles/troubleshooting.md

Leonardo
  • 237
  • 1
  • 10
fico7489
  • 7,931
  • 7
  • 55
  • 89
  • I had a similar issue with my dev machine, and can confirm your solution works. I'm using Vagrant/VirtualBox with a bridged + host-only adapter, with a Debian guest O.S and Windows 10 host. – Rob Dec 04 '15 at 08:08
  • Same issue for me. I had IPV6. I disabled the IPV6 by `sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"` and tried `composer install` again. It works for me – Linga Feb 03 '16 at 08:00
0

Writing the given lines in your composer.json files and then run composer update following the next composer command. Hope it helps someone as it does to me. This problem is frequently faced and here is the solution

"repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        },
        { "packagist": false }
    ]
Rashi Goyal
  • 933
  • 9
  • 15