The heroku command exists in these Ruby versions?

风流意气都作罢 提交于 2020-01-02 02:52:13

问题


After I updated my Ruby version with rbenv I wasn't able to use the Heroku command-line tool. I got this error:

> heroku
rbenv: heroku: command not found

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

Reinstalling the tool belt from toolbelt.heroku.com didn't help.


回答1:


I switched to my previous Ruby version 2.0.0p195 and uninstalled the gem 'heroku'

rbenv global 2.0.0p195

gem uninstall heroku

Then I switched to the latest Ruby version 2.0.0p353 and reinstalled Toolbelt toolbelt.heroku.com

rbenv global 2.0.0p353



回答2:


If you're using rbenv, here are the steps I follow to fix this.

The error

rbenv: heroku: command not found

The `heroku' command exists in these Ruby versions:
  2.2.2

What to do

  1. rbenv local 2.2.2
  2. gem uninstall heroku
  3. rbenv rehash

Good to go!




回答3:


Heroku does not recommend using heroku gem from the recent times. If you have already installed the gem, uninstall the gem first with:

$ gem uninstall heroku

then install the toolbelt from Heroku as specified on Heroku site:

For ubuntu/debian:

$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

For other linux:

$ wget -qO- https://toolbelt.heroku.com/install.sh | sh

For Windows/MacOS see instructions on links.




回答4:


I was having a similar issue. I had the heroku gem install on various ruby versions and despite the fact I had installed the heroku toolbelt from that package downloaded from their site, I was still getting:

rbenv: heroku: command not found

I found that after I had uninstalled the gem from all my ruby versions I had to run:

rbenv rehash

After that I found that everything work perfectly. I found this out from this stackoverflow answer:

ruby - heroku: command not found




回答5:


I also had this problem, if you do the following command in the terminal:

which convert

And you get back this: Users/user_name/.rbenv/shims/convert, you should remove this file in your shims.

rm Users/user_name/.rbenv/shims/convert

If you do which convert again it should give back a different url: /usr/local/bin/convert




回答6:


On MacOS, the thing here is that rbenv was getting confused along with brew and the heroku binary.

Heroku recommends a brew install for Macs. Now, you need to make sure that you don't have the gem installed with any other Ruby version managed with rbenv.

If you do, just reinstall them, and you'll be good to go.



来源:https://stackoverflow.com/questions/20761318/the-heroku-command-exists-in-these-ruby-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!