Composer 在 elasticbeanstalk 上部署 Laravel 应用程序时出错 [英] Composer error deploying laravel application on elasticbeanstalk

查看:30
本文介绍了Composer 在 elasticbeanstalk 上部署 Laravel 应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在弹性 beanstalk 上托管了一个 Laravel 应用程序,它也与代码管道连接.当我部署应用程序时,我在 ebs 面板上收到此错误:

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

这是我的 composer.json

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"
        ]
    }
}

推荐答案

所以我才知道发生了什么!我试图增加我的实例,然后当我下载完整的日志时有新信息:

So I just find out what was going on! I tried to increase my instance and then when I downloaded the complete log there were new information:

021/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)

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

      [2m+9 vendor frames [22m
  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

我在 vscode 上看不到那些 ascii,但是当我用 sublime 打开项目时,它们就在那里!我猜我的实例内存不足,因此它没有注销太多,当我改变层时,更多的信息被注销.我刚刚删除了那些 ascii,现在它工作得很好.

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.

这篇关于Composer 在 elasticbeanstalk 上部署 Laravel 应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆