Laravel Composer 更新错误 - 无法解码响应:zlib_decode():数据错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33009276/
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:28:19  来源:igfitidea点击:

Laravel composer update error - Failed to decode response: zlib_decode(): data error

phplaravelcomposer-phplaravel-5.1

提问by reshma kr

I have a problem to update dependencies in my project. Issue:

我在更新项目中的依赖项时遇到问题。问题:

Failed to decode response: zlib_decode(): data error Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-modefor more info

无法解码响应:zlib_decode():数据错误以降级模式重试,查看https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode了解更多信息

回答by Mahdi Younesi

In some cases It's only because of poor or interrupted internet connections

在某些情况下这只是因为互联网连接不良或中断

One solution might be changing your internet form Wi-Fi to Ethernet.

一种解决方案可能是将您的互联网从 Wi-Fi 更改为以太网。



If you are using ESET antivirus, go in "Advanced Settings" and disable "HTTP-scanner" under "web access protection"

如果您使用的是 ESET 防病毒软件,请进入“高级设置”并禁用“Web 访问保护”下的“HTTP 扫描程序”



If you're using Virtualbox, Then you might need to downgrade to resolve the issue

如果您使用的是 Virtualbox,那么您可能需要降级以解决问题



If you are using IPv6, try disabling it.

如果您使用的是 IPv6,请尝试禁用它。

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

回答by firman

If you are using ESET antivirus, go in "Advanced Settings" and disable "HTTP-scanner" under "web access protection"

如果您使用的是 ESET 防病毒软件,请进入“高级设置”并禁用“Web 访问保护”下的“HTTP 扫描程序”

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.

如果您使用的是 IPv6,请尝试禁用它。如果这解决了您的问题,请联系您的 ISP 或服务器主机,问题不在于 Packagist 级别,而在于您和 Packagist 之间的路由规则(即整个互联网)。修复这些问题的最佳方法是提高对有能力修复它的网络工程师的认识。

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

要在 Linux 上禁用 IPv6,请尝试使用以下命令,它会在您的配置中附加一条优先使用 IPv4 而非 IPv6 的规则:

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

回答by sagesolutions

I had this issue too, it ended up being a Virtualbox issue. I needed to downgrade to version 5.1.6 to resolve it. (I was running 5.1.8)

我也有这个问题,它最终是一个 Virtualbox 问题。我需要降级到 5.1.6 版才能解决它。(我正在运行 5.1.8)

Also, I read that running 5.0.28 also caused this issue, and downgrading to 5.0.10 resolved it.

另外,我读到运行 5.0.28 也会导致这个问题,降级到 5.0.10 解决了这个问题。

回答by Rashi Goyal

Add these lines in composer.json and then run composer update.

在 composer.json 中添加这些行,然后运行 ​​composer update。

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

Happy coding!

快乐编码!