1

我运行了 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"
}
}
4

3 回答 3

2

如果有人在 sensio 分发包 = 5 时遇到相同的错误,那么您的问题应该是致命错误:第 16 行的 app/console 中找不到 Class 'Symfony\Component\Console\Input\ArgvInput'

于 2015-11-30T09:07:15.490 回答
1

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

composer self-update

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

然后再次运行更新。

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

于 2013-03-13T13:00:08.743 回答
0

您的引导文件未正确重建,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
于 2013-03-13T10:36:32.397 回答