我正在尝试使用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)
答案 0 :(得分:1)
Heroku将默认使用NodeJS buildpack。快速简便的修复方法是将index.html重命名为index.php。
这将使Heroku使用它的PHP构建包,不需要任何实际先决条件。它将发出有关想要composer.json文件的警告,但这不会造成任何伤害。