Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwighBundle] Script cache:clear returned with error code 255 #26541

Closed
xsuntel opened this issue Mar 15, 2018 · 4 comments
Closed

[TwighBundle] Script cache:clear returned with error code 255 #26541

xsuntel opened this issue Mar 15, 2018 · 4 comments

Comments

@xsuntel
Copy link

xsuntel commented Mar 15, 2018

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.6

Hi, guys

I have a problem following.
Could you please give me an advice?

###> symfony/framework-bundle ###
APP_ENV=prod

$ composer install --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating optimized 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
!!  PHP Fatal error:  Uncaught Error: Class 'Symfony\Bundle\TwigBundle\TwigBundle' not found in C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\src\Ker
nel.php:32
!!  Stack trace:
!!  #0 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\http-kernel\Kernel.php(403): App\Kernel->registerBundles()
!!  #1 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\http-kernel\Kernel.php(122): Symfony\Component\HttpKernel\Kernel->initializeBundl
es()
!!  #2 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\framework-bundle\Console\Application.php(64): Symfony\Component\HttpKernel\Kernel
->boot()
!!  #3 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\console\Application.php(143): Symfony\Bundle\FrameworkBundle\Console\Application-
>doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!!  #4 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\bin\console(39): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Inp
ut\ArgvInput))
!!  #5 {main}
!!    thrown in C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\src\Kernel.php on line 32
!!
@Simperfit
Copy link
Contributor

Could you please provide a reproducer ?

@javiereguiluz
Copy link
Member

The error message gives a clue about what's happening:

PHP Fatal error:  Uncaught Error: Class 'Symfony\Bundle\TwigBundle\TwigBundle'

It looks like TwigBundle is missing or not installed ... but it's required in config/bundles.php. Try reinstalling Twig: composer require twig

@xsuntel
Copy link
Author

xsuntel commented Mar 16, 2018

Hi @Simperfit , @javiereguiluz

Thank you for your reply.

I have been trying to release my new application using Symfony 4.0.6 on Elastic Beanstalk of Amazon Web Service. However, I have a problem about "Script cache:clear returned with error code 255 !! (Executor::NonZeroExitStatus)" when the application is deploying.

[root@ip-172-31-15-155 log]# vi ./eb-activity.log
~
Installing dependencies (including require-dev) from lock file
  Package operations: 157 installs, 0 updates, 0 removals
    .... 
    - Installing symfony/twig-bundle (v4.0.6): Loading from cache
    - Installing symfony/profiler-pack (v1.0.3): 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
  !!   (Executor::NonZeroExitStatus)

[2018-03-09T13:38:10.167Z] INFO  [3189]  - [Application update app-0ee2-180309_223714@54/AppDeployStage0/AppDeployPreHook/10_composer_install.sh] : Activity failed.
[2018-03-09T13:38:10.168Z] INFO  [3189]  - [Application update app-0ee2-180309_223714@54/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2018-03-09T13:38:10.168Z] INFO  [3189]  - [Application update app-0ee2-180309_223714@54/AppDeployStage0] : Activity failed.
[2018-03-09T13:38:10.168Z] INFO  [3189]  - [Application update app-0ee2-180309_223714@54] : Completed activity. Result:
  Application update - Command CMD-AppDeploy failed

so I have tested the issue on my laptop again.

  • Windows 10 64bit
  • PhpStorm 2017.3
  • JRE: 1.8.0_152-release-1024-b15 amd64
  • JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

the testing scenario is following

$ cat ./.env
###> symfony/framework-bundle ###
APP_ENV=prod

$ composer install --no-dev --optimize-autoloader

Generating optimized 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
!!  PHP Fatal error:  Uncaught Error: Class 'Symfony\Bundle\TwigBundle\TwigBundle' not found in C:\Users\xsunt\PhpstormProjec
ts\xsun\tv\4.0\src\Kernel.php:32
!!  Stack trace:
!!  #0 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\http-kernel\Kernel.php(403): App\Kernel->registerBundles()
!!  #1 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\http-kernel\Kernel.php(122): Symfony\Component\HttpKernel\K
ernel->initializeBundles()
!!  #2 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\framework-bundle\Console\Application.php(64): Symfony\Compo
nent\HttpKernel\Kernel->boot()
!!  #3 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\vendor\symfony\console\Application.php(143): Symfony\Bundle\FrameworkBundl
e\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Conso
leOutput))
!!  #4 C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\bin\console(39): Symfony\Component\Console\Application->run(Object(Symfony
\Component\Console\Input\ArgvInput))
!!  #5 {main}
!!    thrown in C:\Users\xsunt\PhpstormProjects\xsun\tv\4.0\src\Kernel.php on line 32
!!

a minute ago, I have reinstalled twig using "composer require twig" but It the same issue.
so I have installed a demo application of Symfony 4.0.6 again. but It seems to be not normal.

$ composer install --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 10 removals
  - Removing symfony/phpunit-bridge (v3.3.6)
  - Removing sensio/generator-bundle (v3.1.6)
  - Removing friendsofphp/php-cs-fixer (v2.2.5)
  - Removing gecko-packages/gecko-php-unit (v2.1)
  - Removing sebastian/diff (1.4.3)
  - Removing symfony/polyfill-php54 (v1.4.0)
  - Removing symfony/polyfill-php55 (v1.4.0)
  - Removing ircmaxell/password-compat (v1.0.4)
  - Removing symfony/polyfill-php72 (v1.4.0)
  - Removing dama/doctrine-test-bundle (v3.1.0)
Generating optimized autoload files
    Skipped installation of bin bin/doctrine-dbal for package doctrine/dbal: file not found in package
    Skipped installation of bin bin/doctrine for package doctrine/orm: file not found in package
    Skipped installation of bin bin/doctrine.php for package doctrine/orm: file not found in package
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle
" from namespace "Sensio\Bundle\GeneratorBundle".
Did you forget a "use" statement for another namespace? in C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\app\AppKernel.php:48
Stack trace:
#0 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(450): AppKernel-
>registerBundles()
#1 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(116): Symfony\Co
mponent\HttpKernel\Kernel->initializeBundles()
#2 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php(1
37): Symfony\Component\HttpKernel\Kernel->boot()
#3 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php(1
24): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
#4 C:\Us in C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\app\AppKernel.php on line 48
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an ex
ception


  [RuntimeException]
  An error occurred when executing the ""cache:clear --no-warmup"" command:
  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorB
  undle" from namespace "Sensio\Bundle\GeneratorBundle".
  Did you forget a "use" statement for another namespace? in C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\app\AppKernel.php:48
  Stack trace:
  #0 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(450): AppKe
  rnel->registerBundles()
  #1 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(116): Symfo
  ny\Component\HttpKernel\Kernel->initializeBundles()
  #2 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.
  php(137): Symfony\Component\HttpKernel\Kernel->boot()
  #3 C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.
  php(124): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
  #4 C:\Us in C:\Users\xsunt\PhpstormProjects\xsun\tv\demo\app\AppKernel.php on line 48


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts]
[--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [
--ignore-platform-reqs] [--] [<packages>]...

I am going to close this contest because of the duplicate content -symfony/flex#329

Let me know if you need any information.

Best Regards,

@xsuntel xsuntel closed this as completed Mar 16, 2018
@kguiougou
Copy link

I had the same issue after removing twig but keeping var-dumper in dev (which depends on Twig).
I solved it by switching
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
to
Symfony\Bundle\TwigBundle\TwigBundle::class => ['dev' => true],
in file bundles.php
And by moving the twig.yaml from packages/ to packages/dev/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants