zlib_decode():doctrine2教程中使用composer时发生数据错误



更新:不久前,我按照评论中的建议将这个问题发布到了错误跟踪器上,现在我运行了新版本composer的干净安装(composer版本7131607ad1d251c790ce566119d647e008972aa5 2014-05-27 14:26:24(,问题已经修复。

原帖:我正在尝试使用他们的教程学习如何使用doctrine2http://docs.doctrine-project.org/en/latest/tutorials/getting-started.html

但由于某种原因,我在尝试运行composer install:时遇到了这个错误

  [ErrorException]           
  zlib_decode(): data error

以下是composer.json:的内容

{
    "require": {
        "doctrine/orm": "2.4.*",
        "symfony/yaml": "2.*"
    },
    "autoload": {
        "psr-0": {"": "src/"}
    }
}

编辑:PHP版本5.5.9。

EDIT:composer install -vvv:的输出

Reading ./composer.json
Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Executing command (CWD): svn info --xml
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing C:/Users/User/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache
Installing dependencies (including require-dev)
Downloading https://packagist.org/p/provider-active$1874cad4a77f2dbd91c33e813330434e6c38cd940846c58a610595dac158d161.json
Writing C:/Users/User/AppData/Local/Composer/repo/https---packagist.org/p-provider-active.json into cache
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
Downloading https://packagist.org/p/provider-archived$02a49245f4912f279bea7cd3a287cb32b6ab02623037965e5f9665bf27fe3ec9.json
  [ErrorException]
  zlib_decode(): data error
Exception trace:
 () at phar://C:/composer/composer/src/Composer/Util/RemoteFilesystem.php:217
 ComposerUtilErrorHandler::handle() at n/a:n/a
 zlib_decode() at phar://C:/composer/composer/src/Composer/Util/RemoteFilesystem
.php:217
 ComposerUtilRemoteFilesystem->get() at phar://C:/composer/composer/src/Compos
er/Util/RemoteFilesystem.php:82
 ComposerUtilRemoteFilesystem->getContents() at phar://C:/composer/composer/sr
c/Composer/Repository/ComposerRepository.php:612
 ComposerRepositoryComposerRepository->fetchFile() at phar://C:/composer/compo
ser/src/Composer/Repository/ComposerRepository.php:519
 ComposerRepositoryComposerRepository->loadProviderListings() at phar://C:/com
poser/composer/src/Composer/Repository/ComposerRepository.php:271
 ComposerRepositoryComposerRepository->whatProvides() at phar://C:/composer/co
mposer/src/Composer/DependencyResolver/Pool.php:254
 ComposerDependencyResolverPool->computeWhatProvides() at phar://C:/composer/c
omposer/src/Composer/DependencyResolver/Pool.php:243
 ComposerDependencyResolverPool->whatProvides() at phar://C:/composer/composer
/src/Composer/DependencyResolver/Solver.php:149
 ComposerDependencyResolverSolver->setupInstalledMap() at phar://C:/composer/c
omposer/src/Composer/DependencyResolver/Solver.php:163
 ComposerDependencyResolverSolver->solve() at phar://C:/composer/composer/src/
Composer/Installer.php:467
 ComposerInstaller->doInstall() at phar://C:/composer/composer/src/Composer/Ins
taller.php:215
 ComposerInstaller->run() at phar://C:/composer/composer/src/Composer/Command/I
nstallCommand.php:122
 ComposerCommandInstallCommand->execute() at phar://C:/composer/composer/vendo
r/symfony/console/Symfony/Component/Console/Command/Command.php:241
 SymfonyComponentConsoleCommandCommand->run() at phar://C:/composer/composer
/vendor/symfony/console/Symfony/Component/Console/Application.php:892
 SymfonyComponentConsoleApplication->doRunCommand() at phar://C:/composer/com
poser/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 SymfonyComponentConsoleApplication->doRun() at phar://C:/composer/composer/s
rc/Composer/Console/Application.php:117
 ComposerConsoleApplication->doRun() at phar://C:/composer/composer/vendor/sym
fony/console/Symfony/Component/Console/Application.php:121
 SymfonyComponentConsoleApplication->run() at phar://C:/composer/composer/src
/Composer/Console/Application.php:83
 ComposerConsoleApplication->run() at phar://C:/composer/composer/bin/composer
:43
 require() at C:composercomposer:15
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--ver
bose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

在过去的一天里,我花了很多时间试图处理zlib_decode(): data error问题,这肯定与您要安装的确切软件包无关。它必须与代理和/或糟糕的互联网连接有关。禁用防病毒软件对我的情况没有帮助,因为我没有在Mac上使用防病毒软件。这些都是最终有所帮助的东西。

1.通过将HTTPS添加到您的composer.json中,强制HTTPS进行包检索

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://packagist.org"
    },
    {"packagist": false}
  ],
  "require": { /* your packages as usual */ }
}

2.如果您仍然遇到问题,请尝试运行composer diag。在我的案例中,很少有消息是:

Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up

在完成composer self-update --update-keys并按照说明进行下一次尝试后,一切都很好。

在我的案例中,它是Avast防病毒软件。禁用所有更新后没有问题。

如果您使用debian/ubuntu:,只需在您的机器上安装解压缩即可

sudo apt-get install unzip

这对我有用!

相关内容

  • 没有找到相关文章

最新更新