【问题标题】:Issues Deploying Github Branch From Heroku从 Heroku 部署 Github 分支的问题
【发布时间】:2021-03-06 10:33:04
【问题描述】:

我有一个 PHP 应用程序,可以在我的本地计算机和 Heroku 上正常运行。它连接到 Heroku 的 Github 存储库,我正在努力部署一个分支。

每当我点击“部署分支”时,我都会收到以下错误消息。

-----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/php.tgz
       
 !     ERROR: Application not supported by this buildpack!
 !     
 !     The 'heroku/php' buildpack is set on this application, but was
 !     unable to detect a PHP codebase.
 !     
 !     A PHP app on Heroku requires a 'composer.json' at the root of
 !     the directory structure, or an 'index.php' for legacy behavior.
 !     
 !     If you are trying to deploy a PHP application, ensure that one
 !     of these files is present at the top level directory.
 !     
 !     If you are trying to deploy an application written in another
 !     language, you need to change the list of buildpacks set on your
 !     Heroku app using the 'heroku buildpacks' command.
 !     
 !     For more information, refer to the following documentation:
 !     https://devcenter.heroku.com/articles/buildpacks
 !     https://devcenter.heroku.com/articles/php-support#activation
       More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
 !     Push failed

我已阅读错误消息,并且我同时拥有 composer.json 和 index.php 文件。以下是我的应用程序的结构:

my_project:
- vendor/
- .gitignore
- .env
- composer.json
- composer.lock
- index.php
- Procfile

我有什么遗漏吗?

【问题讨论】:

  • 根文件夹中有 composer.json 还是它们位于子文件夹中(如“my_project”)?错误消息说:“Heroku 上的 PHP 应用程序在目录结构的根目录中需要一个 'composer.json'”
  • "my_project" 是所有文件所在的根文件夹。
  • 您是否也在上传文件夹my_project?如果是,则仅上传内容,而不是文件夹,因为这会将您的代码放入子文件夹 (my_project) 而不是根目录(my_project 文件夹所在的位置)。
  • 我的主目录中有一个名为 Web Projects 的目录。这是我保存所有项目的地方。现在,我为我目前正在进行的项目创建了一个新目录my_project。因此,my_project 是该项目的根目录/文件夹,其中初始化了 git 并保留了所有文件。我从这个目录中推送到 Heroku。

标签: php github heroku


【解决方案1】:

我忘了回来更新这个问题,所以在这里。

不幸的是,我还没有完全理解 Github 和 Heroku 之间的流程。我将 Heroku git URL 作为远程添加到本地存储库中,并且我正在从本地计算机提交/推送代码到 Heroku,并期望它然后转到 Github。然而,这不是它的工作方式。

我必须添加到 Github 存储库的远程链接并将更改推送到它,然后从那里部署到 Heroku - 在 Heroku 的“部署”选项卡下。这样,它就像一个魅力。

【讨论】:

    猜你喜欢
    • 2018-08-27
    • 2021-09-07
    • 1970-01-01
    • 2018-08-07
    • 2021-02-14
    • 2015-06-05
    • 2014-03-02
    • 2021-09-01
    • 2016-11-20
    相关资源
    最近更新 更多