views:

133

answers:

3

I am trying to get a Ruby on Rails app hosted free somewhere, and Heroku is looking like my last resource. It is supposed to work on Linux, and the gem installs with no errors, but whenever I run any Heroku command it spits out several errors, all connected, and talking about a failed 'require.' I looked it up in the code, and it says:

require 'readline'  

That is it.

I have tried to install every variation of libreadline that I can find and think of, but none of it makes any difference. Any ideas here?

+1  A: 

It could be that your system installed version of Ruby is not build with readline support. If so then you could reinstall it from source and select the correct configure parameters for readline support. That's not only annoying but means you'd have to manually maintain updates yourself.

Better still would be to abandon your system Ruby altogether in favor of one installed with RVM

  1. Install RVM as described here
  2. Install libreadline-dev

    $ sudo apt-get install libreadline-dev

  3. Install a version of ruby (e.g. 1.8.7)

    $ rvm install 1.8.7

    $ rvm --default 1.8.7

  4. Install your rails and Heroku gems under the RVM ruby

    $ gem install rails heroku taps ... # Note no sudo!

  5. See if your problem persists

  6. If so, then do this:

    $ cd ~/.rvm/src/ruby-1.8.7-p299/ext/readline

    $ ruby extconf.rb

    $ make

    $ make install

bjg
A: 

Ubuntu's ruby-full package depends on libreadline-ruby and should pull in everything both you and it needs. If you have tried installing ruby by installing a bunch of separate packages you might be missing something. If that's the case go back and install ruby-full.

I have a script I use to rebuild my Rails Environment whenever I install the latest Ubuntu. It installs everything you need for Heroku (which is where I host my apps) as well. You might want to take a peek at it and see if there is anything there that you are missing.

If ruby-full doesn't sort you out, I would second Bjg's advice and ditch the system ruby for RVM.

Mike Williamson
A: 

I got it to work, but it was rather a hack. I hunted down the readline.so file from where it was installed (in some strange spot) and did a hard link to where ruby was looking for readline, and it worked. Not optimum, and I will definitely try what you guys recommend next time. Thanks!

Sir Emeth