简体   繁体   English

作曲家更新出现错误

[英]composer update gives error

Whenever I run composer update it gives me following: 每当我运行composer update时,都会显示以下内容:

Loading composer repositories with package information

Updating dependencies (including require-dev)
Generating autoload files
Updating the "app/config/parameters.yml" file



  [Symfony\Component\DependencyInjection\Exception\OutOfBoundsException]  
  The index "4" is not in the range [0, 3].                               



Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception



  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command.  



Exception trace:
 () at /var/www/api.agorafy.com/trunk/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:190
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /var/www/api.agorafy.com/trunk/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:62
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:206
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:174
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:120
 Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///usr/local/bin/composer/src/Composer/Installer.php:336
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:136
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:146
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]

I am not able to resolve it I have tried following things: 我无法解决它,我尝试了以下操作:

  1. Clear Cache before running composer update. 在运行作曲家更新之前清除缓存。
  2. Delete bin and vendor folder then run composer update. 删除bin和供应商文件夹,然后运行composer update。
  3. system restart. 系统重启。
  4. uninstall APC (not sure about this but uninstalled apc) Please help on this issue. 卸载APC(不确定,但已卸载apc)请在此问题上提供帮助。

My Composer.json is this: 我的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",
        "symfony/symfony":                          "~2.4",
        "doctrine/orm":                             "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle":                 "~1.2",
        "twig/extensions":                          "~1.0",
        "symfony/assetic-bundle":                   "~2.3",
        "symfony/swiftmailer-bundle":               "~2.3",
        "symfony/monolog-bundle":                   "~2.4",
        "sensio/distribution-bundle":               "~2.3",
        "sensio/framework-extra-bundle":            "~3.0",
        "sensio/generator-bundle":                  "~2.3",
        "incenteev/composer-parameter-handler":     "2.1.*@dev",
        "jms/di-extra-bundle":                      "1.5.*@dev",
        "friendsofsymfony/rest-bundle":             "1.4.*@dev",
        "nelmio/api-doc-bundle":                    "2.5.*@dev",
        "willdurand/hateoas-bundle":                "1.0.*@dev",
        "hautelook/templated-uri-bundle":           "1.0.*@dev",
        "willdurand/rest-extra-bundle":             "1.0.*@dev",
        "escapestudios/wsse-authentication-bundle": "2.3.x-dev",
        "knplabs/gaufrette":                        "dev-master",
        "knplabs/knp-gaufrette-bundle":             "dev-master",
        "amazonwebservices/aws-sdk-for-php":        "dev-master",
        "cybernox/amazon-webservices-bundle":       "dev-master",
        "escapestudios/wsse-authentication-bundle": "2.3.x-dev",
        "doctrine/doctrine-fixtures-bundle":        "2.2.*",
        "symfony/filesystem":                       "2.5.*@dev",
        "snc/redis-bundle":                         "1.1.x-dev",
        "predis/predis":                            "0.8.x-dev",
        "hwi/oauth-bundle":                         "0.4.*@dev"
    },
    "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",
        "discard-changes": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.4-dev"
        }
    }
}

EDIT 编辑

services.yml services.yml

parameters:
    application_p_api.userprovider.class: Application\PApiBundle\Provider\UserProvider
    application_p_api.amazon_s3.class: AmazonS3
    application_p_api.file_uploader.class: Application\PApiBundle\Services\FileUploader
    application_p_api.tsession.class: Application\PApiBundle\Services\TSSession

services:
    service.s3nfs:
        class: Application\PApiBundle\Services\s3nfs
        arguments: [@service_container]

    application_p_api.amazon_s3:
        class: %application_p_api.amazon_s3.class%
        arguments: 
            - { key: %aws_key%, secret: %aws_secret% }
    amazon_api_service: "@application_p_api.amazon_s3" #alias to application_p_api.amazon_s3 service

    application_p_api.file_uploader:
        class: %application_p_api.file_uploader.class%
        arguments: [@file_uploader_filesystem, @service_container]

    application_p_api.mailer:
        class: Application\PApiBundle\Services\MailsSender
        arguments: ['@service_container', '@mailer', '@twig']
        public: true
    mails_sender: "@application_p_api.mailer"   #alias to application_p_api.mailer service

    application_p_api.tsession:
        class: Application\PApiBundle\Services\TSSession
        arguments: [@service_container]

    #Form Validator Services
    p_api_contact_email_validator:
        class: Application\PApiBundle\Validator\Constraints\ContactEmailValidator
        arguments: [@doctrine.orm.read_only_entity_manager]
        tags:
            - { name: validator.constraint_validator, alias: contact_email_validator }

    p_api_not_user_email_validator:
        class: Application\PApiBundle\Validator\Constraints\NotUserEmailValidator
        arguments: [@doctrine.orm.read_only_entity_manager]
        tags:
            - { name: validator.constraint_validator, alias: not_user_email_validator }

    p_api_not_pending_user_email_validator:
        class: Application\PApiBundle\Validator\Constraints\NotPendingUserEmailValidator
        arguments: [@doctrine.orm.read_only_entity_manager]
        tags:
            - { name: validator.constraint_validator, alias: not_pending_user_email_validator }

    p_api_password_requirements_validator:
        class: Application\PApiBundle\Validator\Constraints\PasswordStrengthValidator
        arguments: ~
        tags:
            - { name: validator.constraint_validator, alias: password_requirements_validator }

Rest of the Code is Here: https://github.com/jbpashu/composer-error-analysis-code 代码的其余部分在这里: https : //github.com/jbpashu/composer-error-analysis-code

Please have a look if needed. 如果需要,请看看。

Use this command to see a detailed error: 使用此命令查看详细的错误:

$ composer update -vvv

I think you have a problem in the configuration of one of your service where you set one more argument than what it is expected (it may happen when you alter the definition of a service in your extension file or in a compiler pass for instance). 我认为您在其中一项服务的配置中设置了一个比预期多的参数(例如,当您在扩展文件或编译器遍历中更改服务的定义时,可能会发生此问题)。

This can also be a compatibility problem with one of the bundle. 这也可能是其中一个捆绑包的兼容性问题。 Remember to do the following to have the lastest version of Composer before doing your composer update : 在进行composer update之前,请记住执行以下操作以拥有最新版本的composer update

$ sudo composer self-update

您是否尝试过在composer update之前做redis-cli flushall吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM