1

Here are the steps, I am following:

Cloning my repository from github

git clone https://github.com/EresDev/EresNoteSymfony.git .

Updating .env file with APP_ENV=prod

Then performing install

composer install --no-dev

I get following error:

.
.
.
  - 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

However, it works fine if I just use composer install without --no-dev

What can I do to make it work with --no-dev

Please refer to repository to access code if required.

Eres
  • 1,559
  • 1
  • 16
  • 25

1 Answers1

2

apparently you have somehow managed to turn error display off (or it's some default). I get a very distinct error message when I run composer install --no-dev (run 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
!!  

you should somehow turn error display on ;o)

update:

your config/bundles.php:6 says:

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

which essentially says, the twigbundle is expected in prod as well as in dev. thus the error? (but anyway, the point still stands, that you should display errors when running on cli)

after you change that line in your bundles.php, you have to move your twig.yaml config into the dev/test folders, I suppose.

Jakumi
  • 8,043
  • 2
  • 15
  • 32
  • thanks for looking into it. I also get this error if I miss one step: that is setting the .env to setup APP_ENV=prod. In that case the error makes sense because I need twig in dev. But I don't need twig in prod in symfony or --no-dev in composer. So it doesn't solve my problem. – Eres Mar 30 '19 at 00:01
  • 1
    I set APP_ENV=prod in .env and still got that error ;o/ @EresDev updated my answer. – Jakumi Mar 30 '19 at 00:05
  • 1
    Super Awesome! Yes, it was Twig. I updated bundles.php file to have twig for `['dev' => true, 'test' => true]` I needed it just for profiler. Then as you guided, I moved twig.yaml to both config/packages/dev and config/packages/test and it is working now. Strange that twig was supposed to come with web profiler and it was required in dev and test only. – Eres Mar 30 '19 at 00:43
  • Also, it is strange that composer was not giving extra information in my case. Probably it was a slightly old version of composer because I am using a shared hosting. – Eres Mar 30 '19 at 00:45
  • 1
    @EresDev I suspect composer not being the problem here, but instead the php config/ini being used on command line "hiding" (not showing) the errors. (if it can't be changed separately, for whatever reason, there might be some workaround or whatever, but that's probably out of scope here) maybe your hoster can help. – Jakumi Mar 30 '19 at 00:51