流明 - >第54行出错 - require():需要打开失败

时间:2016-02-14 11:12:40

标签: php heroku lumen dingo-api lumen-5.2

我安装了一个新的Lumen副本作为Heroku应用程序。我还在其中实现了packange Dingo:https://github.com/dingo/api/但是当我尝试加载所有服务器时返回给我这个错误:

2016-02-14T11:07:45.657820+00:00 app[web.1]: [14-Feb-2016 11:07:45 UTC] PHP Warning:  require(/app/vendor/dingo/api/src/helpers.php): failed to open stream: No such file or directory in /app/vendor/composer/autoload_real.php on line 54
2016-02-14T11:07:45.657998+00:00 app[web.1]: [14-Feb-2016 11:07:45 UTC] PHP Fatal error:  require(): Failed opening required '/app/vendor/dingo/api/src/helpers.php' (include_path='.:/app/.heroku/php/lib
/php') in /app/vendor/composer/autoload_real.php on line 54

我尝试删除供应商文件夹等,然后重新安装它,但结果是相同的

编辑:我的composer.json是:

{
    "name": "laravel/lumen",
    "description": "The Laravel Lumen Framework.",
    "keywords": ["framework", "laravel", "lumen"],
    "license": "MIT",
    "type": "project",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.5.9",
        "laravel/lumen-framework": "5.2.*",
        "vlucas/phpdotenv": "~2.2",
        "dingo/api": "1.0.x@dev"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "phpunit/phpunit": "~4.0",
        "dingo/api": "1.0.x@dev"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/",
            "database/"
        ]
    }
}
编辑2:我现在在我的本地机器上尝试过,而且Dingo的Lumen工作正常,所以这是Heroku叹息的事情。如何在Heroku Logs中查看流明日志?

1 个答案:

答案 0 :(得分:-1)

我认为您错过了在Heroku App中添加配置。要使您的Heroku应用程序获取所有作曲家要求,您可以在Lumen App的根目录上运行:

heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php

再次进行更改,然后将更改推送到heroku存储库,例如:

git push heroku master

修改

为了实现这一点,我有自己的方式将Lumen App部署到Heroku。

lumen new my-app
cd my-app
# Here you can change your composer.json dependencies
composer require dingo/api

制作你的proc文件

vim Procfile

# Content of Procfile
web: vendor/bin/heroku-php-apache2 public

初始化回购

git init
git add -A .
git commit -m "[INIT] Initial commit."

创建Heroku应用程序:

heroku create
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
git push heroku master

访问您的heroku应用程序。