php - PHP Symfony 试图从命名空间“Sonata\IntlBundle”加载类“SonataIntlBundle”
问题描述
我一般是 Symfony 和 PHP 的新手,我只想从 GitHub 建立一个项目,指令说我必须运行 composer update。所以在这个命令之后,一个错误日志:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SonataIntlBundle" from namespace "Sonata\IntlBundle".
Did you forget a "use" statement for another namespace? in /Users/xxx/Documents/project/app/AppKernel.php:28
Stack trace:
#0 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(427): AppKernel->registerBundles()
#1 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(128): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(62): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Obj
ect(Symfony\Component\Console\Output\ConsoleOutput))
#4 /U in /Users/xxx/Documents/project/app/AppKernel.php on line 28
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SonataIntlBundle" from namespace "Sonata\IntlBundle".
Did you forget a "use" statement for another namespace? in /Users/xxx/Documents/project/app/AppKernel.php:28
Stack trace:
#0 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(427): AppKernel->registerBundles()
#1 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(128): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(62): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/xxx/Documents/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Obj
ect(Symfony\Component\Console\Output\ConsoleOutput))
#4 /U in /Users/xxx/Documents/project/app/AppKernel.php on line 28
谁能帮我解决这个问题?我有点迷路了。
解决方案
正如@Cid 提到的,我重新克隆了存储库,这次使用 composer install 而不是 update ,它工作得很好!
推荐阅读
- xamarin.forms - SQLiteAsyncConnection.InsertAsync(obj) 不返回正确的密钥
- vue.js - HTML 结束标签不在 Vue 模板中的片段中
- python - Python:如何在两个数据帧之间合并和划分?
- python-3.x - 使用tornado.ioloop.IOLoop.run_in_executor时如何避免线程过多?
- android - 如何在警报对话框上显示 ShowCase (Android)
- python - 将 ID_number 添加到 XML
- python-3.x - 如何检测 .txt 文件是否被另一个进程使用并终止它?
- python - 使用 pandas 重新采样 OHLC 数据
- rabbitmq - RabbitMQ 一个消费者一次接收所有消息
- reactjs - URL 将更新 url 页面不会使用 react-router 呈现