0

I can't seem to be able to use mechanize in irb. Here is the error message returned when attempting to : require 'mechanize'

2.2.0 :003 > require 'mechanize'
LoadError: cannot load such file -- mechanize
    from /home/harvey/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in`require'
from /home/harvey/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from (irb):3
from /home/harvey/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'

The gem has been successfully installed already.

Any ideas what is wrong ?

Thanks!

harvey
  • 299
  • 1
  • 8

2 Answers2

0

do you have rubygems required already as part of your irb initialization? if not try requiring it first

require 'rubygems'
require 'mechanize'
Doon
  • 19,719
  • 3
  • 40
  • 44
  • yes, I already have 'rubygems' required. and that works and return 'true'. – harvey May 11 '15 at 01:16
  • and you are 100% sure that mechanize i installed in the current rvm ruby and gemset? – Doon May 11 '15 at 01:18
  • 'mechanize' is installed. "Successfully installed mechanize-2.7.3 1 gem installed Installing ri documentation for mechanize-2.7.3... Installing RDoc documentation for mechanize-2.7.3... " however, for some reason, it does not show in the list when i type "gem list" :-\ – harvey May 11 '15 at 01:56
0

ok, i could install the gem with simply : gem install mechanize

Before I was doing sudo gem install mechanize, which did not work.

Not sure why it would not work with sudo. I mean it does say the gem is installed, but it does not appear in the gem list. I would still be interested to know why the instructions did not work previously if anyone knows.

harvey
  • 299
  • 1
  • 8