easy-deploy-bundle icon indicating copy to clipboard operation
easy-deploy-bundle copied to clipboard

err :: Script @auto-scripts was called via post-install-cmd

Open Alexain opened this issue 6 years ago • 4 comments

In Symfony 4.1.x when deploying the app, int "---> Installing Composer dependencies" section the scripts crash with this message:

| err :: Script @auto-scripts was called via post-install-cmd

Composer version is 1.7.2

Alexain avatar Oct 02 '18 08:10 Alexain

Add this to your deploy configuration:

->composerInstallFlags('--prefer-dist --no-interaction --no-dev')

This will disable the --quiet flag from composer. Most likely something went wrong there with composer install

ferdynator avatar Oct 29 '18 10:10 ferdynator

If you remove the --quiet flag and there are package updates wouldn't this still cause it to fail?

kingchills avatar Feb 19 '20 17:02 kingchills

In my case it was due to .env file:

| err :: Executing script cache:clear [KO]
| err ::  [KO]
| err :: Script cache:clear returned with error code 255
| err :: !!  PHP Fatal error:  Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "/var/www/project/releases/20200619075019/.env" environment file. in /var/www/project/releases/20200619075019/vendor/symfony/dotenv/Dotenv.php:510
| err :: !!  Stack trace:
| err :: !!  #0 /var/www/project/releases/20200619075019/vendor/symfony/dotenv/Dotenv.php(65): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
| err :: !!  #1 /var/www/project/releases/20200619075019/vendor/symfony/dotenv/Dotenv.php(85): Symfony\Component\Dotenv\Dotenv->load('/var/www/bm-dok...')
| err :: !!  #2 /var/www/project/releases/20200619075019/config/bootstrap.php(17): Symfony\Component\Dotenv\Dotenv->loadEnv('/var/www/bm-dok...')
| err :: !!  #3 /var/www/project/releases/20200619075019/bin/console(30): require('/var/www/bm-dok...')
| err :: !!  #4 {main}
| err :: !!    thrown in /var/www/project/releases/20200619075019/vendor/symfony/dotenv/Dotenv.php on line 510
| err :: !!
| err :: Script @auto-scripts was called via post-install-cmd
[ERROR] Cancelling the deployment and reverting the changes

Fixed it by:


    /**
     * Executed just before doing the composer install, setting the permissions, installing assets, etc.
     */
    public function beforePreparing()
    {
        $this->runRemote('cp {{ deploy_dir }}/repo/.env {{ project_dir }}/.env');
        $this->runRemote('cp {{ deploy_dir }}/.env.prod {{ project_dir }}/.env.prod');
    }

numediaweb avatar Jun 19 '20 07:06 numediaweb

@numediaweb Hey, where did you exactly put the function beforePreparing() please ?

adxl avatar Jun 29 '22 16:06 adxl