WWW::Mechanize problem (probably Ubuntu only(?))

I am working on a small screen-scraping utility written in Ruby, and since I have been working previously with RubyfulSoup, I wanted to give WWW::Mechanize a try this time.

So i have installed the WWW::mechanize gem:

sudo gem install mechanize

I wanted to try a ‘Hello world’ application first, to see wheter it works. Here are some official examples (click on ‘Examples’). I Copy&pasted the first one, run and got the following error:

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__': no such file to load -- net/https (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from /usr/lib/ruby/gems/1.8/gems/mechanize-0.4.4/lib/mechanize.rb:15
...
...

After some googling i have found the answer: I had to install libopenssl-ruby, and the error was gone.

I wonder if you have to install this amount of additional packages on other distributions also? From the time I am using Ruby/Rails I did not have other distro than Ubuntu, but back in my Python days I have been running on gentoo and I don’t remember such problems. Ubuntu is really very cool, but it seems you have to know well which packages do you need and install them manually when it comes to coding/development…

8 thoughts on “WWW::Mechanize problem (probably Ubuntu only(?))

  1. Hi. I’m new to Ruby and Rails, and I’m coming from Java. And getting a similar error message when I try to run WEBrick:

    rhyolight@laptop:~/dev/rails/photos$ script/server
    /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require': no such file to load -- initializer (LoadError)
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
    require’
    from ./script/../config/boot.rb:16
    from script/server:2:in `require’
    from script/server:2

    A few other places have told me to reinstall some packages, but I guess I haven’t found the right one yet, because this fix didn’t work for me.

    It looks like something is wrong with the rubygems installation? I’ve reinstalled all the ruby and gems packages from Synaptic. Can you help me make sense of this error message?

    Also… do I need to restart anything in Linux when I reinstall something?

  2. Pingback: Osiblog » Installing Ruby on Ubuntu Server with Mechanize gem - blog about technology, webdesign, software development, whisky, linux and graphics

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>