Heroku deployment from Circle CI failing




I am getting following error when trying to deploy to heroku app from circle ci. Its confusing as I am trying to just build master and deploy from that branch. Here is my circle.yml file:

    version: 6.10.0

    - rm -rf node_modules
    - npm i -g @angular/cli

    - ng build --prod

    branch: master
      appname: ngnode-fullstack # appname must not include upper-case characters


The error is suggesting that the branch pushed and what HEAD is on Heroku has diverged. Try pushing to Heroku locally from your computer and you should see the same message. Do whatever merge, rebase, or force push that you need to do and then you should be good.


thanks @FelicianoTech that was the problem. Build succeeds now when both heroku and master in in sync with commits.

But now the problem I am having is that when I build a node app from command line on local machine. As part of the build I have some static assets (e.g js/css files which gets compiled into a dist directory) and when I include that dist directory while checking into master and then deploy to heroku using:

git push heroku master

Heroku website work as compiled dist directory which has index.html in it as well and node is serving that index file as a single page application.

However, from circle ci, I have a build script before heroku deployment. (The whole configuration is shown in script above, the build script is ng build --prod, which compiles angular 2 application into dist directory). Build step completes successfully by circle, but the dist doesn’t get deployed to heroku.

Here is the last build:

and the site url is:

Am I right in thinking that like other CI servers, you just push your source code and any production artifacts which get produced as part of build/release step, CI picks up and pushes them?

I am a little confused here. Am I missing a step here, so that I don’t have to include dist directory in master and ci pushes them as part of heroku deployment?