N.Yoon
N.Yoon

Reputation: 31

How to fix "ERROR: Application not supported by 'heroku/nodejs' buildpack" error in Heroku?

I am trying to deploy my simple web application using Heroku, but I keep getting this message.

-----> 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

I installed node.js on my computer, and not sure whether I need to create a package.json file and put it into the same directory with other .html and .css files. (https://docs.npmjs.com/creating-a-package-json-file)

Upvotes: 0

Views: 475

Answers (1)

James Allen
James Allen

Reputation: 1019

Heroku will default to the NodeJS buildpack. The quick and easy fix is rename index.html to index.php.

This will make Heroku use it's PHP build pack, which doesn't require any real prerequisites. It will throw a warning about wanting a composer.json file but that won't hurt anything.

Upvotes: 2

Related Questions