Symfony 部署:使用 composer install --no-dev 时出现错误代码 255

Symfony deployment: error code 255 with composer install --no-dev

步骤如下,我正在执行:

正在从 github

克隆我的存储库
git clone https://github.com/EresDev/EresNoteSymfony.git .

正在使用 APP_ENV=prod

更新 .env 文件

然后执行安装

composer install --no-dev

我收到以下错误:

.
.
.
  - Installing symfony/translation (v4.2.4): Loading from cache
  - Installing symfony/validator (v4.2.4): Loading from cache
  - Installing symfony/yaml (v4.2.4): Loading from cache
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  
Script @auto-scripts was called via post-install-cmd

但是,如果我只使用 composer install 而不使用 --no-dev

,它工作正常

我该怎么做才能让它与 --no-dev

一起工作

如有需要,请参考repository获取代码。

显然您设法以某种方式关闭了错误显示(或者它是默认设置)。当我 运行 composer install --no-dev (运行 with commit e722218...)

时,我收到一条非常明显的错误消息
!!  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TwigBundle" from namespace "Symfony\Bundle\TwigBundle".
!!  Did you forget a "use" statement for another namespace? in [path]/EresNoteSymfony/src/Kernel.php:23
!!  Stack trace:
!!  #0 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!!  #1 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!!  #2 [path]/EresNoteSymfony/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!!  #3 [path]/EresNoteSymfony/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!!  #4 [path]/EresNoteSymfony/bin/console(38): Symfony\Component\Console\Application->run(Object(Symfony\Componen in [path]/EresNoteSymfony/src/Kernel.php on line 23
!!  

你应该以某种方式打开错误显示 ;o)

更新:

你的 config/bundles.php:6 说:

Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],

从本质上讲,twigbundle 在生产和开发中都是预期的。因此错误? (但无论如何,重点仍然存在,当 运行ning on cli 时你应该显示错误)

在 bundles.php 中更改该行后,我想您必须将 twig.yaml 配置移动到 dev/test 文件夹中。