symfony: SF4 Deployment to Prod "Script cache:clear returned with error code 255"
Symfony version(s) affected: 4.2
Description
While deploying to production, i get following error:
# EasyDeploy installation script
| err :: Generating optimized autoload files
| out :: ocramius/package-versions: Generating version class...
| out :: ocramius/package-versions: ...done generating version class
| err :: > post-install-cmd: @auto-scripts
| err :: Executing script cache:clear
| err :: Executed script cache:clear [KO]
| err :: [KO]
| err :: Script cache:clear returned with error code 255
| err :: !!
| err :: Script @auto-scripts was called via post-install-cmd
How to reproduce Checkout the named repo and run following commands
rm -rf vendor && composer install --prefer-dist --no-interaction --no-dev --optimize-autoloader
Result:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineFixturesBundle" from namespace "Doctrine\Bundle\FixturesBundle".
!! Did you forget a "use" statement for another namespace? in /Users/bjorn/code/web/wavetrophy/src/Kernel.php:33
!! Stack trace:
!! #0 /Users/bjorn/code/web/wavetrophy/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 /Users/bjorn/code/web/wavetrophy/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 /Users/bjorn/code/web/wavetrophy/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 /Users/bjorn/code/web/wavetrophy/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 /Users/bjorn/code/web/wavetrophy/bin/console(34): Symfony\Component\Console\Application->run(Object in /Users/bjorn/code/web/wavetrophy/src/Kernel.php on line 33
!!
!! Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineFixturesBundle" from namespace "Doctrine\Bundle\FixturesBundle".
!! Did you forget a "use" statement for another namespace? in /Users/bjorn/code/web/wavetrophy/src/Kernel.php on line 33
!!
!! Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineFixturesBundle" from namespace "Doctrine\Bundle\FixturesBundle".
!! Did you forget a "use" statement for another namespace? in /Users/bjorn/code/web/wavetrophy/src/Kernel.php on line 33
!!
!! Call Stack:
!! 0.1653 3944552 1. Symfony\Component\Debug\ErrorHandler->handleException(???, ???) /Users/bjorn/code/web/wavetrophy/vendor/symfony/debug/ErrorHandler.php:0
!!
!!
Script @auto-scripts was called via post-update-cmd
Possible Solution
No clue, sorry.
Additional context
The complete code can be found here:
https://github.com/wavetrophy/wavetrophy
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 17 (5 by maintainers)
@eldk
We fixed the bug by changing the
APP_ENVvariable in.env-File to:prodFor your error, it looks like your
.env-File is not readable.If you do not get any output from the console, try to set
At the top of the bin/console file. With this the console will display all errors that occur. DO NOT PUT THIS IN PROD
@D4rkMindz
You added the
doctrine/doctrine-fixtures-bundleas a development requirement. While deploying you’re runningcomposer installusing the--no-devflag.This is not related to symfony.
Look my user environments variable (in shell terminal) :
APP_ENVdefined in your shell environment overwrite value in.envfile.APP_ENV=prod composer install --no-dev --optimize-autoloader --prefer-distis the solution.Hi, I have the same problem:
all works well in prod env, not in dev. But my .env* files are readable.
I have an identical problem with PHP 7.2.20.
The identical project but with PHP 7.2.19 works perfectly.
Linked with this problem https://github.com/symfony/symfony/issues/32395