Search code examples
ruby-on-railsrubyherokurbenvheroku-toolbelt

The `heroku' command exists in these Ruby versions:


I'm having major issues with the heroku toolbelt. I'm using the cedar 14 stack and when I am trying to use a ruby version that isn't ruby 2.0.0-dev I get this error.

rbenv: heroku: command not found

The `heroku' command exists in these Ruby versions:
  2.0.0-dev

I need heroku to be working with ruby 1.9.3 and I don't think cedar 14 supports that version of ruby. Can someone explain first, why I am only allowed to use heroku with ruby 2.0.0-dev and also how I can install a older stack that supports ruby 1.9.3?


Solution

  • The problem is that there are two heroku executables on your system: one in system paths such as /usr/local/bin/heroku (provided by Toolbelt), and one in rbenv's shims because Ruby 2.0.0-dev had "heroku" gem installed.

    Because rbenv's shims directory usually have higher precedence, it will block invocation from ever executing the heroku executable provided by Toolbelt.

    The solution is to uninstall any instance of "heroku" gem and relying solely on Toolbelt for all heroku usage on the command line:

    for v in `rbenv whence heroku`; do RBENV_VERSION=$v gem uni heroku -ax; done
    rbenv rehash
    which heroku