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
composer鏡像不支援https引起
開啟命令列視窗(windows用戶)或控制台(使用者)或控制台(使用者)或控制台Linux、Mac 使用者),進入你的專案的根目錄(也就是composer.json 檔案所在目錄),執行以下指令:
composer config repo.packagist composer https://packagist.phpcomposer.com
上述指令將會在目前專案中的 composer.json 檔案的最後自動加入鏡像的設定資訊(你也可以自己手工加入):
「repositories」: {
“packagist”: {
“type”: “composer”,
“url”: “https://packagist.phpcomposer.com”
}
}
以 laravel 專案的 composer.json 設定檔為例,執行上述指令後如下所示(注意最後幾行):
{
“name”: “laravel/laravel”,
“description”: “The Laravel Framework.”,
“keywords”: [“framework”, “laravel”],
“license”: “MIT”,
“type”: “project”,
“require”: {
“php”: “>=5.5.9”,
“laravel/framework”: “5.2.*”
},
“require-dev”: {
“fzaninotto/faker”: “~1.4”,
“mockery/mockery”: “0.9.*”,
“phpunit/phpunit”: “~4.0”,
“symfony/css-selector”: “2.8.|3.0.“,
“symfony/dom-crawler”: “2.8.|3.0.”
},
“autoload”: {
「classmap」: [
“database”
],
“psr-4”: {
“App”: “app/”
}
},
“autoload-dev”: {
「classmap」: [
“tests/TestCase.php”
]
},
“scripts”: {
“post-root-package-install”: [
“php -r ”copy(‘.env.example’, ‘.env’);””
],
“post-create-project-cmd”: [
“php artisan key:generate”
],
“post-install-cmd”: [
“php artisan clear-compiled”,
“php artisan optimize”
],
“pre-update-cmd”: [
“php artisan clear-compiled”
],
“post-update-cmd”: [
“php artisan optimize”
]
},
“config”: {
“preferred-install”: “dist”
},
“repositories”: {
“packagist”: {
“type”: “composer”,
“url”: “https://packagist.phpcomposer.com”
}
}
}
OK,一切都搞定!試試 composer install 來體驗飛一般的速度吧!
以上就介紹了composer install or update 報錯問題解決,包括了composer方面的內容,希望對PHP教程有興趣的朋友有所幫助。