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

后端 未结 11 1063
一向
一向 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:38

    I think remove the folder bundles in the web directory "web/bundles" before running the update. This should solve the assets install problems in post-update-cmd

    0 讨论(0)
  • 2020-12-15 05:38

    this could also caused by an error in some controller, if your code is not clear then you can't update the composer . hope this help

    0 讨论(0)
  • 2020-12-15 05:38

    I came across the same problem running composer.phar install with Symfony3 on Mac OS (Mavericks) with MAMP: script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-update-cmd event terminated with an exception.

    Solved by updating the PHP version from 5.4 to 5.6. As Symfony runs inside MAMP, I forgot that my system default PHP version is not supported by Symfony3. After the PHP upgrade, the composer run with success.

    0 讨论(0)
  • 2020-12-15 05:38

    I solved this by updating your composer.json to match the php version you have on your machine

    "config" : {
        "bin-dir" : "bin",
        "platform" : {
            "php" : "7.0.21" //Update this same as your $> php -v
        }
    },
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题