解决composer版本升级报错问题Failed to decode response: zlib_decode(): data error

Posted WXiangQian王先森

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决composer版本升级报错问题Failed to decode response: zlib_decode(): data error相关的知识,希望对你有一定的参考价值。

引入composer包时报了如下错误

Warning from https://mirrors.aliyun.com/composer: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2

文章目录

升级本地的composer版本

composer self-update

返回如下信息则升级成功

Updating to version 2.0.8 (stable channel).
   Downloading (100%)         
Use composer self-update --rollback to return to version 1.10.7

报错:Failed to decode response: zlib_decode(): data error

composer self-update

Updating to version 2.0.8 (stable channel).
   Downloading (100%)         
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 (100%)         
Use composer self-update --rollback to return to version 1.10.7

这时候就应该先执行composer self-update --rollback回滚升级

检测命令

检测一些常见的问题

composer diagnose

操作超时(IPv6问题)

如果未正确配置IPv6,您可能会遇到错误。常见错误是:

The “https://getcomposer.org/version” file could not be downloaded: failed to
open stream: Operation timed out
我们建议您修复IPv6设置。如果不可能,则可以尝试以下解决方法:

解决方法Linux:

在linux上,似乎运行此命令有助于使ipv4流量具有比ipv6更高的优先级,这比完全禁用ipv6更好。

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

解决方法Windows:

在Windows上,恐怕唯一的方法是完全禁用ipv6(在Windows或家庭路由器中)。

解决方法Mac OS X:

获取您的网络设备的名称:

networksetup -listallnetworkservices

在该设备上禁用IPv6(在本例中为“ Wi-Fi”):

networksetup -setv6off Wi-Fi

Run composer …
(去执行composer self-update)

您可以使用以下方法再次启用IPv6:

networksetup -setv6automatic Wi-Fi

就是说,如果这可以解决您的问题,请与您的ISP商讨以尝试解决路由错误。这是使每个人都能解决问题的最佳方法。

参考资料:https://getcomposer.org/doc/articles/troubleshooting.md

以上是关于解决composer版本升级报错问题Failed to decode response: zlib_decode(): data error的主要内容,如果未能解决你的问题,请参考以下文章

phpStudy安装composer时,SSL报错(Failed to enable crypto)的解决方法

安装composer后报错proc_open(): fork failed - Cannot allocate memory

Apache Flink写入Clickhouse报错 code: 1002, ip:8123 failed to respond

Apache Flink写入Clickhouse报错 code: 1002, ip:8123 failed to respond

解决import tensorflow报错:ImportError: DLL load failed: 找不到指定的模块

Module build failed (from ./node_modules/babel-loader/lib/index.js):报错解决方案