EasyCorp / easy-deploy-bundle

The easiest way to deploy your Symfony applications
https://easycorp.io/EasyDeploy
MIT License
471 stars 103 forks source link

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

Open Alexain opened 6 years ago

Alexain commented 6 years ago

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

ferdynator commented 6 years ago

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

kingchills commented 4 years ago

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

numediaweb commented 4 years ago

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');
    }
adxl commented 2 years ago

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