Search code examples
herokuheroku-cli

Heroku can't find package.json during build although I have it


When I push my node app to heroku master I get this log

remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://codon-
buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
remote:        Node.js: package.json not found in application root

I can't find the reason why this would happen as I clearly have in my root directory. I checked using git ls-files and it appears.

Is it possible that my application root is not the same as my repository root? How would one config that?


Solution

  • It seems that when I push to heroku master, heroku pushes the main branch of my local repository to heroku instead of the branch I'm currently in. So what I had to do was pushing with:

    git push heroku mybranchname:master
    

    so that my branch (not the master) gets pushed