composer: ZIP uncompress errors when installing/updating dependencies
My composer.json
:
"require": {
"php" : ">=5.5.9",
"algolia/algoliasearch-client-php" : "^1.6",
"beberlei/metrics" : "^2.0",
"// ... and more packages here"
}
Output of composer diagnose
:
$ 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 oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
When I run this command:
$ composer install
I get the following output:
- Installing beberlei/metrics (v2.3.0)
Downloading: 100%
Update failed ('<my-project>/vendor/beberlei/metrics/18ddcb3d31a1a6b6aaf65fef675bc3c9' is not a zip archive.
Failed to execute unzip '<my-project>/vendor/beberlei/metrics/18ddcb3d31a1a6b6aaf65fef675bc3c9' -d '<my-project>/vendor/composer/9c528af1' && chmod -R u+w '<my-project>/vendor/composer/9c528af1'
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of <my-project>/vendor/beberlei/metrics/18ddcb3d31a1a6b6aaf65fef675bc3c9 or
<my-project>/vendor/beberlei/metrics/18ddcb3d31a1a6b6aaf65fef675bc3c9.zip, and cannot find <my-project>/vendor/beberlei/metrics/18ddcb3d31a1a6b6aaf65fef675bc3c9.ZIP, period.)
Would you like to try reinstalling the package instead [yes]?
- Removing beberlei/metrics (v2.4.0)
- Installing beberlei/metrics (v2.3.0)
Downloading: 100%
Invalid zip file, retrying...
- Installing beberlei/metrics (v2.3.0)
Downloading: 100%
Invalid zip file, retrying...
- Installing beberlei/metrics (v2.3.0)
Downloading: 100%
Failed to download beberlei/metrics from dist: '<my-project>/vendor/beberlei/metrics/18ddcb3d31a1a6b6aaf65fef675bc3c9' is not a zip archive.
Now trying to download from source
[...]
(and the package is installed correctly)
At the end the packages are installed … but after several retries and after downloading them from source, which is much slower. The error happens randomly for some packages, but not for all of them.
This never happened to me before. The only recent change that I made was installing PHP 7.1:
PHP 7.1.0 (cli) (built: Dec 2 2016 09:19:56) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.1.0, Copyright (c) 1999-2016, by Zend Technologies
with blackfire v1.14.1~mac-x64-non_zts71, https://blackfire.io, by Blackfireio Inc.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (8 by maintainers)
composer clearcache
andcomposer global update
solved my problem.I had the same issue. It seems that some downloaded zip files were broken. Run
composer clearcache
solved my problem.Same issue still not working with php 7.4
bash and cmd had the same issues.
composer clearcache
fixed it for me too. (Windows 7 Pro. 64bit , PHP 7.2.10 , Composer 1.8.5)If it is a composer cache issue and the ‘clear-cache’ isn’t doing its thing, you could try deleting the files manually … https://stackoverflow.com/questions/22700728/composer-loading-from-cache
MacOS 10.14.5 Composer version 1.8.5 2019-04-09 17:46:47 PHP 7.2.19 (cli) (built: Jun 17 2019 09:03:55) ( NTS ) <-- installed via Brew
Same symptoms.
Not fixed by
composer clearcache
norcomposer global update
sadly. 😦Also tried updating to PHP 7.3 in case that helped, but no cigar.
Also tried another internet connection to rule out network issues, no cookie. 😦
Snippet of error:
Any more ideas before I go ahead and re-install everything!