1
votes

I am using Ubuntu 10.10, RVM and Ruby 1.9.2 and trying to install Heroku for the first time. Ruby 1.9.2 is the default for RVM and the only version I have been using.

The gem install heroku worked but trying to run heroku leads to "command not found" error. The executables folder /home/mike/.rvm/gems/ruby-1.9.2-p0/bin is already in the PATH. However, I see that Heroku was installed in /var/lib/gems/1.8/gems. gem list heroku does not show any installed gem. Simply creating symbolic links in .../ruby-1.9.2-p0 did not solve the problem, though it gives a different error:

/usr/lib/ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
  from /usr/lib/ruby/1.8/rubygems.rb:214:in `activate'
  from /usr/lib/ruby/1.8/rubygems.rb:1082:in `gem'
  from /home/mike/.rvm/gems/ruby-1.9.2-p0/bin/heroku:18

I don't understand gem and rvm well enough to know what to try next. I read in another question that Heroku supports Ruby 1.9.1 but not 1.9.2 but don't know if that is still true. If so, how does one use Rails and Ruby 1.9.x with Heroku?

3

3 Answers

4
votes

The problem turned out to be related to sudo and Ubuntu. RVM depends on the rvm_path environment variable to get started. According to answers to another question, sudo does not preserve the PATH variable in some versions of secure Linux. I don't know if it should ever preserve the rvm_path variable, but in any case, it does not on my version of Ubuntu. So the result of sudo gem install is that the default, RVM-provided version of Ruby is not available during the installation, and the system-default is used. In my case that is version 1.8. The installation appears to succeed, but it is not going to the right gem version.

The solution was simply to use gem install instead of sudo gem install.

0
votes

If 'gem list' doesn't show the Heroku gem then that would seem to be the problem (the error you posted occurs when running a Heroku command without the gem installed).

Have you tried installing it again? Any error messages?

It does work with 1.9.2.

0
votes

Had the exact same problem on Mac OSX 10.6.5. Reinstalling without sudo worked in this case also. Thanks for the explanation... being a nube, I would have never figured it out.