溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Composer 提示 zlib_decode (): data error怎么辦

發(fā)布時間:2021-01-22 10:34:38 來源:億速云 閱讀:370 作者:小新 欄目:軟件技術(shù)

這篇文章主要介紹了Composer 提示 zlib_decode (): data error怎么辦,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

環(huán)境說明

CentOS Linux 7
PHP 5.6.36
Composer 1.8.6

亞馬遜香港服務器

原始輸出

清除緩存

$ composer clearcache
Cache directory does not exist (cache-vcs-dir): 
Clearing cache (cache-repo-dir): /home/work/.cache/composer/repo
Clearing cache (cache-files-dir): /home/work/.cache/composer/files
Clearing cache (cache-dir): /home/work/.cache/composer
All caches cleared.

校驗

$ composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Composer version: 1.8.6
PHP version: 5.6.36
PHP binary path: /home/work/apps/php/bin/php

查看配置

$ composer config -l
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://mirrors.aliyun.com/composer/
[process-timeout] 300
[use-include-path] false
[preferred-install] auto
[notify-on-install] true
[github-protocols] [https, ssh]
[vendor-dir] vendor (/home/work/www/wanglong/vendor)
[bin-dir] {$vendor-dir}/bin (/home/work/www/wanglong/vendor/bin)
[cache-dir] /home/work/.cache/composer
[data-dir] /home/work/.local/share/composer
[cache-files-dir] {$cache-dir}/files (/home/work/.cache/composer/files)
[cache-repo-dir] {$cache-dir}/repo (/home/work/.cache/composer/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/home/work/.cache/composer/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[bin-compat] auto
[discard-changes] false
[autoloader-suffix] 
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile] 
[capath] 
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] true
[home] /home/work/.config/composer

安裝

Composer 提示 zlib_decode (): data error怎么辦

調(diào)試過程

Round One

一看到這個問題,首先看了一下 composer 版本,不是最新版本,升級一下吧

$ composer self-update
  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "self-update" is not defined.

Composer 提示 zlib_decode (): data error怎么辦

命令不存在,想了一下,我的用戶好像權(quán)限不足,算了吧。。。。

Round Two

Google 一下,搜索結(jié)果第一條的解決方案是換源,本來用的是阿里云的源,換一下吧

$ composer config repo.packagist composer http://packagist.phpcomposer.com

換個鏡像之后,composer.json 長這樣

{
    "license": "proprietary",
    "require": {
        "php": ">=5.6",
        "guzzlehttp/guzzle": "^6.3",
        "aws/aws-sdk-php": "^3.52"
    },
    "autoload": {
        "psr-4": {
            "Rpc\\": "application/library/Rpc/"
        }
    },
    "repositories": {
        "packagist": {
            "type": "composer",
            "url": "http://packagist.phpcomposer.com"
        }
    }
}

安裝

Composer 提示 zlib_decode (): data error怎么辦

不支持 http 只支持 https,想了想還是不改這個配置吧,不止我一個人用這臺機。。。。

Round Three

我想了下,既然是國外的服務器,我干脆直接把鏡像源全去了,都用默認的,說干就干

composer config -g --unset repos.packagist
composer config --unset repos.packagist
composer clearcache
composer diagnose
composer install -vvv

然后安裝,直接安裝成功了???我還沒反應過來。由于 composer install -vvv 輸出的日志太長了,不太方便截圖,放一個 composer install 的輸出截圖

Composer 提示 zlib_decode (): data error怎么辦

感謝你能夠認真閱讀完這篇文章,希望小編分享的“Composer 提示 zlib_decode (): data error怎么辦”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識等著你來學習!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI