Ruby LoadError, Quick fix

Ruby library load error, takes long time for a newbie but simple hack could get you up and running with your thing.
I just installed RubyFul_Soup[ Ruby port of the hit Python HTML/XML parser Beautiful Soup.] and wanted get started with RadRails , so when I write this line on top

require ‘RubyFulSoup’ as per the example given I get following error

LoadError: No such file to load — rubyfulsoup

The thing is when you install any gem using “gem install” , it installs gem under /usr/lib/ruby/gems/1.8/gems , so somehow ruby does not really get where to pick up gems from , best thing to do a quick sanity check regarding your setup , and you can do that by irb” (Interactive Ruby Shell), just type
bash> irb
irb(main):002:0> require ‘RubyFulSoup’
LoadError: No such file to load — RubyFulSoup
from (irb):2:in `require’
from (irb):2

basically gem installed is “rubyful_soup’ and its under /usr/lib/ruby/gems/1.8/gems
and Ruby looks for files under /usr/lib/ruby/1.8/ , So all I did is copied rubyful_soup.rb file from /usr/lib/ruby/gems/1.8/gems to /usr/lib/ruby/1.8/ and also copy htmltools gem files to /usr/lib/ruby/1.8/, then run

irb(main):001:0> require ‘rubyful_soup’
=> true

This is a quick fix till I figure out the real solution for this


Comments

4 Responses to “Ruby LoadError, Quick fix”

  1. Kelly on April 20th, 2006 10:55 pm

    Instead of copying files around, try this:

    require ‘rubygems’
    require ‘rubyful_soup’

    Worked for me. :)

  2. Rajesh Shetty on April 21st, 2006 11:39 am

    Will try that one, Thanks Kelly

  3. Anonymous on June 28th, 2006 1:49 am

    requiring “rubygems” didn’t work for me.

  4. Anonymous on July 19th, 2006 2:44 pm

    I say briefly: Best! Useful information. Good job guys.
    »

Leave a Reply