Symfony2 post-update-cmd gives “An error occurred when generating the bootstrap file”

后端 未结 11 1102
一向
一向 2020-12-15 05:13

I am currently on Symfony2 2.3.7. When I run the composer update command. In the post-update-cmd a script is run to update symfony2. But it fails:

Script Sen         


        
11条回答
  •  眼角桃花
    2020-12-15 05:42

    I had the same problem and solved it in two parts. The crux of the problem was bad code on my part that wouldn't specifically apply to someone else, but my method for uncovering the issue might be useful to someone else.

    First, I created a temporary file: app/test.php

    use Doctrine\Common\Annotations\AnnotationRegistry;
    use Composer\Autoload\ClassLoader;
    
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', 1);
    
    /**
     * @var ClassLoader $loader
     */
    $loader = require __DIR__.'/../vendor/autoload.php';
    

    You'll notice that is a slimmed down version of app/autoload.php

    Next in my shell, I simply ran:

    php app/test.php
    

    After some trial and error, I discovered that I had an error in a private repo that I had as a requirement in my composer.json file. In my case, and I had a bootstrap file that was calling the very bootstrap.cache.php that we're trying to get composer to create.

    Anyway, this method was useful because it output errors that composer install/update would not, even with "--verbose" enabled and temporarily modifying the code to output all errors.

提交回复
热议问题