Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jessicaosouza's avatar

Composer compilation error

Hi!

I have a laravel app hosted on elastic beanstalk and it is also connected with code pipeline. When I deployed the application I got this error on ebs panel:

ERROR: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.

I don't know if it is related but when I downloaded the logs I found this:

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Here is my composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.3",
        "laravel/framework": "^8.12",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

I can't find anything related =[

0 likes
9 replies
jessicaosouza's avatar

I am not on localhost, It is deployed on aws elastic beanstalk

jlrdw's avatar

Do you have a space in any env variables, if so quote them.

jlrdw's avatar

Double check make sure your packages are correct and try to delete vendor and run composer update or perhaps composer install.

You can also make sure composer is up to date.

Make sure you don't have a stray package somewhere that doesn't exist.

jessicaosouza's avatar

So I just find out what was going on! First I tried your suggestion, but It didn't work. I tried to increase my instance and then when I downloaded the complete log there were new information:

2021/05/25 18:00:11.083949 [INFO] Running command /bin/sh -c composer.phar install --no-ansi --no-interaction 
2021/05/25 18:00:18.791014 [INFO] 
   ParseError 

  syntax error, unexpected character 0x1D, expecting "]"

  at app/Http/Controllers/MailController.php:28
     24▕             'nome' => $request->nome,
     25▕             'email' => $request->email,
     26▕             'assunto' => $request->assunto,
     27▕             'descricao' => $request->descricao,
  ➜  28▕             'local' => $request->localizacao,
     29▕             'pais' => $request->pais
     30▕         ]);
     31▕ 
     32▕         if($response->status() === 200)

      +1 vendor frames 
  2   [internal]:0
      Composer\Autoload\ClassLoader::loadClass("App\Http\Controllers\MailController")

      +9 vendor frames 
  12  routes/web.php:24
      Illuminate\Support\Facades\Facade::__callStatic("post")

2021/05/25 18:00:18.791081 [ERROR] An error occurred during execution of command [app-deploy] - [Install composer dependencies]. Stop running the command. Error: installing composer dependencies failed with error: Command /bin/sh -c composer.phar install --no-ansi --no-interaction  failed with error exit status 1. Stderr:Do not run Composer as root/super user! See https://getcomposer.org/root for details

I couldn't see those ascii on vscode but when I opened the project with sublime they were there! I guess my instance was running out of memory therefore It wasn't logging out much and when I changed tiers, more information was logged out. I just removed those ascii and now it is working just fine.

Thank you for your time!

siangboon's avatar

try composer update... and double check any syntax error on any config files that you have changed if any...

Please or to participate in this conversation.