Bundle: Command Not Found: Heroku

Recently, I had an application where we had to use ruby 1.8.7 instead of default ruby on heroku cedar stack(1.9.x) so what we did was following:
  • Create a Heroku instance and deployed our application on the instance.
  • After deploying we changed the ruby version to 1.8.7 in Gemfile and deployed the application back.
  • Results: A dreaded “Bundle: Command not found” error.
We tried installing bundler and many other things but the error wont go away. We requested for a heroku support at that time and they explained that when you change ruby version after the deployment, heroku yet does not changes the gem path so we have to manually set the config using following commands:
heroku config:add GEM_PATH=vendor/bundle/1.8
We tried the solution and this worked for us. The Heroku team however explained that in case you use a custom ruby in a stack then we need to spin up an instance and then add the ruby directive at the time of deploying the application otherwise the gem path would not be configured. I hope this saves time for someone !!