【问题标题】:Upgrading from symfony 2.1.7 to symfony 2.1.8从 symfony 2.1.7 升级到 symfony 2.1.8
【发布时间】:2015-11-30 17:07:15
【问题描述】:

我运行了 composer update 命令,它从 symfony 2.1.7 更新到了 symfony 2.1.8。这就是我的问题开始的地方。现在当我尝试运行任何 symfony 控制台命令时,我得到如下错误:

 Fatal error: Class 'Symfony\Component\Console\Input\ArgvInput' not found in C:\xampp\htdocs\myproject\app\console on line 16

当我在浏览器中运行我的项目时,我收到了这个错误:

Fatal error: Class 'Symfony\Component\ClassLoader\DebugClassLoader' not found in C:\xampp\htdocs\myproject\app\bootstrap.php.cache on line 542

以前一切正常。

我该如何解决这个问题?

这是我的 composer.json:

{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.1.7",
    "imagine/Imagine": ">=0.2.8",
    "liip/imagine-bundle": "*@dev",
    "knplabs/knp-paginator-bundle": "dev-master",
    "cbsi/doctrine2-nestedset": "dev-master",
    "exercise/htmlpurifier-bundle": "dev-master",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.0.*",
    "twig/extensions": "1.0.*@dev",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.1.*",
    "symfony/monolog-bundle": "2.1.*",
    "sensio/distribution-bundle": "2.1.*",
    "sensio/framework-extra-bundle": "2.1.*",
    "sensio/generator-bundle": "2.1.*",
    "jms/security-extra-bundle": "1.2.*",
    "jms/di-extra-bundle": "1.1.*",
    "kriswallsmith/assetic": "1.1.*@dev"
},
"scripts": {
    "post-install-cmd": [
        "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": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web"
}
}

【问题讨论】:

  • 你更新了所有 symfony 包的完整列表吗?
  • 是的,我已经更新了,请查看我的 composer.json 要求声明。
  • 有时值得尝试删除vendor 文件夹中的所有内容并再次运行composer install 命令。

标签: symfony symfony-2.1


【解决方案1】:

如果有人对sensio distribution bundle=5有同样的错误,那么你的问题应该是Fatal error: Class 'Symfony\Component\Console\Input\ArgvInput' not found in app/console on line 16

【讨论】:

    【解决方案2】:

    尝试更新作曲家 (https://getcomposer.org/doc/03-cli.md#self-update)

    composer self-update
    

    清除其缓存,对于 Windows,其位于 C:\Users\&lt;user&gt;\AppData\Roaming\Composer (https://getcomposer.org/doc/03-cli.md#composer-home)

    然后再次运行更新。

    手动删除 symfony2 缓存文件夹可能会有所帮助。

    【讨论】:

      【解决方案3】:

      您的引导文件未正确重建,composer.json 文件应该有一个脚本条目,可确保为您完成此任务(除非您使用 --no-scripts 标志运行)。

      "scripts": {
          "post-install-cmd": [
              "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": [
              "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
              "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
              "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
              "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
          ]
      }
      

      您可以通过在 symfony 目录中运行以下命令来手动运行构建引导文件的脚本:

      php /vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
      

      【讨论】:

      • 我的 composer.json 中有这些行
      猜你喜欢
      • 1970-01-01
      • 2022-01-10
      • 1970-01-01
      • 2017-03-22
      • 1970-01-01
      • 2022-12-31
      • 1970-01-01
      • 1970-01-01
      • 2017-07-26
      相关资源
      最近更新 更多