这是一个到完整存储库的链接,以防您需要所有文件:https://github.com/tech0tron/civstock-symfony
当我运行docker-compose build --pull --no-cache
时,它一直运行到步骤36,直到它给出这个错误:
+ composer run-script post-install-cmd
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Error: Class "SymfonyBundleTwigBundleTwigBundle" not found in /srv/app/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:131
!! Stack trace:
!! #0 /srv/app/vendor/symfony/http-kernel/Kernel.php(382): AppKernel->registerBundles()
!! #1 /srv/app/vendor/symfony/http-kernel/Kernel.php(766): SymfonyComponentHttpKernelKernel->initializeBundles()
!! #2 /srv/app/vendor/symfony/http-kernel/Kernel.php(128): SymfonyComponentHttpKernelKernel->preBoot()
!! #3 /srv/app/vendor/symfony/framework-bundle/Console/Application.php(166): SymfonyComponentHttpKernelKernel->boot()
!! #4 /srv/app/vendor/symfony/framework-bundle/Console/Application.php(72): SymfonyBundleFrameworkBundleConsoleApplication->registerCommands()
!! #5 /srv/app/vendor/symfony/console/Application.php(171): SymfonyBundleFrameworkBundleConsoleApplication->doRun()
!! #6 /srv/app/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(54): SymfonyComponentConsoleApplication->run()
!! #7 /srv/app/vendor/autoload_runtime.php(29): SymfonyComponentRuntimeRunnerSymfonyConsoleApplicationRunner->run()
!! #8 /srv/app/bin/console(11): require_once('...')
!! #9 {main}
!! thrown in /srv/app/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php on line 131
!!
Script @auto-scripts was called via post-install-cmd
The command '/bin/sh -c set -eux; mkdir -p var/cache var/log; composer install --prefer-dist --no-dev --no-progress --no-scripts --no-interaction; composer dump-autoload --classmap-authoritative --no-dev; composer symfony:dump-env prod; composer run-script post-install-cmd; chmod +x bin/console; sync' returned a non-zero code: 255
ERROR: Service 'php' failed to build : Build failed
我的bundles.php文件应该显示了TwigBundle类正在被注册:
<?php
return [
SymfonyBundleFrameworkBundleFrameworkBundle::class => ['all' => true],
SymfonyBundleSecurityBundleSecurityBundle::class => ['all' => true],
DoctrineBundleDoctrineBundleDoctrineBundle::class => ['all' => true],
DoctrineBundleMigrationsBundleDoctrineMigrationsBundle::class => ['all' => true],
SymfonyBundleMakerBundleMakerBundle::class => ['dev' => true],
SymfonyBundleTwigBundleTwigBundle::class => ['all' => true],
SymfonyBundleWebProfilerBundleWebProfilerBundle::class => ['dev' => true, 'test' => true],
SymfonyWebpackEncoreBundleWebpackEncoreBundle::class => ['all' => true],
];
我应该做些什么来纠正这个问题?
我检查了您提供的存储库。您的依赖项列表中缺少symfony/twig-bundle
,因此没有安装它。
它在第36步停止的原因是当你运行composer symfony:dump-env prod
时,你会从Symfony收到一个错误,当它试图处理你的bundles.php并且不能打包。
你需要正确的bundle,然后再试一次。
composer require symfony/twig-bundle