运行后
composer create-project symfony/website-skeleton my-project
我收到一个错误:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught SymfonyComponentDebugExceptionClassNotFoundException: Attempted to load class "FileResource" from namespace "App".
!! Did you forget a "use" statement for "SymfonyComponentConfigResourceFileResource"? in /Users/bastiennicolau/Documents/dev_web/my-project/src/Kernel.php:39
!! Stack trace:
!! #0 /Users/bastiennicolau/Documents/dev_web/my-project/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php(80): AppKernel->configureContainer(Object(SymfonyComponentDependencyInjectionContainerBuilder), Object(SymfonyComponentConfigLoaderDelegatingLoader))
!! #1 [internal function]: AppKernel->SymfonyBundleFrameworkBundleKernel{closure}(Object(SymfonyComponentDependencyInjectionContainerBuilder))
!! #2 /Users/bastiennicolau/Documents/dev_web/my-project/vendor/symfony/dependency-injection/Loader/ClosureLoader.php(38): call_user_func(Object(Closure), Object(SymfonyComponentDependencyInjectionContainerBuilder))
!! #3 /Users/bastiennicolau/Documents/dev_web/my-project/vendor/symfony/config/Loader/Deleg in /Users/bastiennicolau/Documents/dev_web/my-project/src/Kernel.php on line 39
!!
我已经尝试了一些事情,例如更改 composer.json
中的 psr-4
值,并且在运行 cache:clear
后仍然有相同的错误......
你会怎么做才能让它工作?谢谢。
您可以尝试通过打开 src/kernel 来解决此问题.php然后转到第 39 行。
删除"文件资源",然后再次开始键入。您的IDE(假设PHPStorm(将建议您使用来自以下位置的FileResource:Symfony\Component\Config\Resource\FileResource;
这应该自动添加到内核.php的顶部。
接受并运行作曲家更新。该问题应得到解决。
最好维斯