无法使用composer update -v更新“正在更新依赖项(包括require-dev)”

时间:2013-06-22 15:07:57

标签: symfony composer-php

无法使用composer update -v

更新“更新依赖项(包括require-dev)”
  

使用Windows 7 PHP:5.4.7为CLI Composer版本启用OpenSSL   c93aecee4d3998d17a1986f042187d38dd394397

获取错误:

E:\xampp\htdocs\partner-portal>composer update -v
Loading composer repositories with package information
Updating dependencies (including require-dev)

  [ErrorException]
  zlib_decode(): data error

Exception trace:
 () at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:166
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 zlib_decode() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:166
 Composer\Util\RemoteFilesystem->get() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:76
 Composer\Util\RemoteFilesystem->getContents() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:541
 Composer\Repository\ComposerRepository->fetchFile() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:278
 Composer\Repository\ComposerRepository->whatProvides() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:240
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:229
 Composer\DependencyResolver\Pool->whatProvides() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:179
 Composer\DependencyResolver\RuleSetGenerator->addRulesForPackage() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:274
 Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/DependencyResolver/Solver.php:166
 Composer\DependencyResolver\Solver->solve() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Installer.php:446
 Composer\Installer->doInstall() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Installer.php:208
 Composer\Installer->run() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Command/UpdateCommand.php:103
 Composer\Command\UpdateCommand->execute() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:882
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:212
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar://C:/ProgramData/Composer/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:119
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar://C:/ProgramData/Composer/bin/composer.phar/bin/composer:43
 require() at C:\ProgramData\Composer\bin\composer.phar:15


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock]
 [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [
-o|--optimize-autoloader] [packages1] ... [packagesN]

修改:添加了composer.json - >

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "composer/composer": "1.0.*@dev",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/intl-bundle": "dev-master",
        "sonata-project/cache-bundle": "dev-master",
        "sonata-project/user-bundle": "dev-master",
        "sonata-project/media-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "process-timeout": 5000
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

1 个答案:

答案 0 :(得分:2)

这似乎与this question中的问题相同。

zlib_decode(): data error

请查看我在那里回复的可能解决方案列表。

此外,请确保您的composer.json和composer.phar都不包含BOM加上两者都是UTF-8编码。

使用

显示更多调试消息
composer -vvv update

请尝试将 Composer / Util / RemoteFilesystem.php 中的if语句从line 164更改为

if ($decode) {
    $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
}

您可以使用koto/phar-util提取/重新构建您的composer.phar。