第一次在Heroku上部署Laravel 5.7时出错

时间:2019-01-24 18:12:34

标签: laravel heroku

我重新安装了Laravel 5.7,尝试在Heroku中进行部署时出现错误。我还在Heroku设置中设置了APP-KEY值和heroku/php Buildpak。

知道发生了什么吗?

构建日志:

-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
       - php (7.3.1)
       - ext-mbstring (bundled with php)
       - apache (2.4.37)
       - nginx (1.8.1)
-----> Installing dependencies...
       Composer version 1.8.0 2018-12-03 10:31:16
       Loading composer repositories with package information
       Installing dependencies from lock file
       Package operations: 53 installs, 0 updates, 0 removals
         - Installing doctrine/inflector (v1.3.0): Downloading (100%)
         - Installing doctrine/lexer (v1.0.1): Downloading (100%)
         - Installing dragonmantank/cron-expression (v2.2.0): Downloading (100%)
         - Installing erusev/parsedown (1.7.1): Downloading (100%)
         - Installing vlucas/phpdotenv (v2.5.2): Downloading (100%)
         - Installing symfony/css-selector (v4.2.2): Downloading (100%)
         - Installing tijsverkoyen/css-to-inline-styles (2.2.1): Downloading (100%)
         - Installing symfony/polyfill-php72 (v1.10.0): Downloading (100%)
         - Installing symfony/polyfill-mbstring (v1.10.0): Downloading (100%)
         - Installing symfony/var-dumper (v4.2.2): Downloading (100%)
         - Installing symfony/routing (v4.2.2): Downloading (100%)
         - Installing symfony/process (v4.2.2): Downloading (100%)
         - Installing symfony/polyfill-ctype (v1.10.0): Downloading (100%)
         - Installing symfony/http-foundation (v4.2.2): Downloading (100%)
         - Installing symfony/contracts (v1.0.2): Downloading (100%)
         - Installing symfony/event-dispatcher (v4.2.2): Downloading (100%)
         - Installing psr/log (1.1.0): Downloading (100%)
         - Installing symfony/debug (v4.2.2): Downloading (100%)
         - Installing symfony/http-kernel (v4.2.2): Downloading (100%)
         - Installing symfony/finder (v4.2.2): Downloading (100%)
         - Installing symfony/console (v4.2.2): Downloading (100%)
         - Installing egulias/email-validator (2.1.7): Downloading (100%)
         - Installing swiftmailer/swiftmailer (v6.1.3): Downloading (100%)
         - Installing paragonie/random_compat (v9.99.99): Downloading (100%)
         - Installing ramsey/uuid (3.8.0): Downloading (100%)
         - Installing psr/simple-cache (1.0.1): Downloading (100%)
         - Installing psr/container (1.0.0): Downloading (100%)
         - Installing opis/closure (3.1.5): Downloading (100%)
         - Installing symfony/translation (v4.2.2): Downloading (100%)
         - Installing nesbot/carbon (1.36.2): Downloading (100%)
         - Installing monolog/monolog (1.24.0): Downloading (100%)
         - Installing league/flysystem (1.0.49): Downloading (100%)
         - Installing ralouphie/getallheaders (2.0.5): Downloading (100%)
         - Installing psr/http-message (1.0.1): Downloading (100%)
         - Installing guzzlehttp/psr7 (1.5.2): Downloading (100%)
         - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
         - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
         - Installing laravel/slack-notification-channel (v1.0.3): Downloading (100%)
         - Installing zendframework/zend-diactoros (1.8.6): Downloading (100%)
         - Installing php-http/promise (v1.0.0): Downloading (100%)
         - Installing php-http/httplug (v1.1.0): Downloading (100%)
         - Installing php-http/guzzle6-adapter (v1.1.1): Downloading (100%)
         - Installing lcobucci/jwt (3.2.5): Downloading (100%)
         - Installing nexmo/client (1.6.1): Downloading (100%)
         - Installing laravel/nexmo-notification-channel (v1.0.1): Downloading (100%)
         - Installing laravel/framework (v5.7.22): Downloading (100%)
         - Installing fideloper/proxy (4.1.0): Downloading (100%)
         - Installing jakub-onderka/php-console-color (v0.2): Downloading (100%)
         - Installing nikic/php-parser (v4.2.0): Downloading (100%)
         - Installing jakub-onderka/php-console-highlighter (v0.4): Downloading (100%)
         - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)
         - Installing psy/psysh (v0.9.9): Downloading (100%)
         - Installing laravel/tinker (v1.0.8): Downloading (100%)
       Generating optimized autoload files
       > Illuminate\Foundation\ComposerScripts::postAutoloadDump
       > @php artisan package:discover --ansi

       In PackageManifest.php line 168:

         The /tmp/build_73d13e43929228fd562bd9df625e545c/bootstrap/cache directory m  
         ust be present and writable.                                                 


       Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
 !     WARNING: A post-autoload-dump script terminated with an error
 !     ERROR: Dependency installation failed!
 !     
 !     The 'composer install' process failed with an error. The cause
 !     may be the download or installation of packages, or a pre- or
 !     post-install hook (e.g. a 'post-install-cmd' item in 'scripts')
 !     in your 'composer.json'.
 !     
 !     Typical error cases are out-of-date or missing parts of code,
 !     timeouts when making external connections, or memory limits.
 !     
 !     Check the above error output closely to determine the cause of
 !     the problem, ensure the code you're pushing is functioning
 !     properly, and that all local changes are committed correctly.
 !     
 !     For more information on builds for PHP on Heroku, refer to
 !     https://devcenter.heroku.com/articles/php-support
 !     
 !     REMINDER: the following warnings were emitted during the build;
 !     check the details above, as they may be related to this error:
 !     - A post-autoload-dump script terminated with an error
 !     Push rejected, failed to compile PHP app.
 !     Push failed

Procfile:

web: vendor/bin/heroku-php-apache2 public/

composer.json,因为之前的额外错误,我将"laravel/dusk"添加到extra-> laravel-> dont-discover

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": [
                "laravel/dusk"
            ]
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "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"
        ]
    }
}

1 个答案:

答案 0 :(得分:0)

a bootstrap/cache/.gitignore file附带了一个新的Laravel安装。它在存储库中的存在(和内容)可确保该目录存在于部署中,但该目录中之内的其他内容不会在源代码管理中出现。

您收到的错误表明您没有将其检入到存储库中(或由于某种原因将其删除了)。签入它应该清除消息,因为该文件夹将存在,您的应用程序可以将其写入。

还有其他一些实例,例如storage/logsstorage/framework的多个子文件夹等。如果在这些目录中收到类似的错误,则将应用相同的修复程序。