我运行了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"
}
}
答案 0 :(得分:2)
如果有人在sensio发布包= 5时出现相同的错误,那么您的问题应该是Fatal error: Class 'Symfony\Component\Console\Input\ArgvInput' not found in app/console on line 16
答案 1 :(得分: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缓存文件夹可能会有所帮助。
答案 2 :(得分: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