Heroku: "No default language could be detected for this app" error thrown for node app

Heroku has a set of default buildpacks, used when it needs to detect the language of your app.
In order to do that detection, it runs the bin/detect command of each of those default buildpacks, until one of them returns a 0 exit code.

This is the command for the node buildpack.
As you can see, it requires a package.json to be located at the root of your app, not in a subfolder.

This is the difference causing your build to fail. You need to put your app at the root of your git repository.


In my case, I hadn't Heroku set up in the root folder, because my GitHub repository was split up into frontend/ and backend/ folders. Each of them had a package.json. Since Heroku needs the package.json file in the root folder of the repository, it cannot detect the language.

In my case, I had to initialize a secondary GitHub repository in the backend/ folder. After the backend project was pushed to GitHub as separate project, git push heroku master worked.


In my case I had pending files needs to be committed to github :)