laravel Composer(Laravel5) 无法解码响应:zlib_decode():数据错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33187112/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:31:43  来源:igfitidea点击:

Composer(Laravel5) Failed to decode response: zlib_decode(): data error

phplaravelcomposer-php

提问by Saad Mehmood

I am trying to install laravel 5.1 dependencies using composer.

我正在尝试使用 composer 安装 laravel 5.1 依赖项。

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 installon project directory it gives me following message and hangs in there:

但是当我composer install在项目目录上运行时,它给了我以下消息并挂在那里:

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

回答by fico7489

From composerdocumentation :

composer文档:

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

如果您已被指向此页面,您需要检查以下几点:

If you are using ESETantivirus, 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 ISPor server host, the problem is not at the Packagistlevel 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.

如果您使用的是ESET防病毒软件,请进入“高级设置”并禁用“Web 访问保护”下的“HTTP 扫描程序”。如果您使用的是IPv6,请尝试禁用它。如果这解决了您的问题,请联系您的ISP或服务器主机,问题不在于Packagist级别,而在于您和 Packagist 之间的路由规则(即整个互联网)。修复这些问题的最佳方法是提高对有能力修复它的网络工程师的认识。

To disable IPv6on Linux, try using this command which appends a rule preferring IPv4over IPv6to your config:

要在Linux上禁用IPv6,请尝试使用此命令,该命令将优先使用IPv4而非IPv6的规则附加到您的配置中:

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

来源:https: //getcomposer.org/doc/articles/troubleshooting.md

回答by Rashi Goyal

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

在 composer.json 文件中写入给定的行,然后在下一个 composer 命令之后运行 composer update。希望它能像对我一样帮助某人。这个问题经常遇到,这里是解决方案

"repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        },
        { "packagist": false }
    ]