【问题标题】:How to fix "ERROR: Application not supported by 'heroku/nodejs' buildpack" error in Heroku?如何修复 Heroku 中的“错误:'heroku/nodejs' buildpack 不支持应用程序”错误?
【发布时间】:2019-12-17 13:40:07
【问题描述】:

我正在尝试使用 Heroku 部署我的简单 Web 应用程序,但我不断收到此消息。

-----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz

 !     ERROR: Application not supported by 'heroku/nodejs' buildpack
 !     
 !     The 'heroku/nodejs' buildpack is set on this application, but was
 !     unable to detect a Node.js codebase.
 !         
 !     A Node.js app on Heroku requires a 'package.json' at the root of
 !     the directory structure.
 !     
 !     If you are trying to deploy a Node.js application, ensure that this
 !     file is present at the top level directory. This directory has the
 !     following files:
 !     
 !     image/
 !     index.html
 !     README.md
 !     sounds/
 !     style.css
 !         
 !     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/nodejs-support#activation
       More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
 !     Push failed

我在我的电脑上安装了node.js,但不确定是否需要创建一个package.json 文件并将其与其他.html 和.css 文件放在同一个目录中。 (https://docs.npmjs.com/creating-a-package-json-file)

【问题讨论】:

    标签: javascript html css heroku package.json


    【解决方案1】:

    Heroku 将默认使用 NodeJS 构建包。快速简单的解决方法是将 index.html 重命名为 index.php。

    这将使 Heroku 使用它的 PHP 构建包,它不需要任何真正的先决条件。它会抛出一个关于需要 composer.json 文件的警告,但这不会伤害任何东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-29
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      • 2020-12-13
      • 1970-01-01
      • 1970-01-01
      • 2018-09-25
      相关资源
      最近更新 更多