Why does Heroku fail to detect Node.js buildpack?

It’s because Heroku thinks you are deploying a Node app. But what you are deploying is the public directory of a Node app, not Node code.

Heroku uses buildpacks to select how the ap is handled. You want to clear that Node association:

buildpacks:clear # clear all buildpacks set on the app

Which means that “Next release will detect buildpack normally.”, that should solve it for you.

ref: https://devcenter.heroku.com/articles/buildpacks


I had similar issue, here are the steps which solved the problem.

heroku buildpacks:set heroku/nodejs
git push heroku master

Basically details are in the more info link -


This situation may also occur if you remove or rename a file that previously led to the automatic detection of your application type and thus the automatic setting of the detected buildpack on your application.



This means that a package.json file isn't checked into the root of your git project, so Heroku is detecting that it isn't a Node.js app. You can see this locally:

git show master:package.json

To fix it, you'll want to be sure there is a package.json in the root of your project (where there is also a .git directory), and add it to git:

git add package.json
git commit -m 'track package.json'

The phrasing ('failed to detect set buildpack') could be improved. It should probably say 'failed to detect Node.js app'. When the buildpack's "detect" script is run (https://github.com/heroku/heroku-buildpack-nodejs/blob/master/bin/detect), it looks for a package.json file to verify that there's a node app available to build.