Question

In the rails interactive shell (rails c), I get a error that says: No such file to load -- Mechanize' when I run require 'mechanize'.

Curiously enough I don't get any error when I enter require 'mechanize' on the ruby shell (irb).

A sample output is shown below:

    rails c 
    Loading development environment (Rails 4.0.2)
    irb(main):001:0> require 'mechanize'
    LoadError: cannot load such file -- mechanize
     from /home/********/.gem/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
     from /home/********/.gem/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
      from /home/********/.gem/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
      from /home/********/.gem/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from (irb):1
      from /home/********/.gem/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start'
      from /home/********/.gem/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start'
      from /home/********/.gem/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>'
      from bin/rails:4:in `require'
      from bin/rails:4:in `<main>'

Regards

Was it helpful?

Solution

add this to Gemfile

gem 'mechanize'

then execute this command on the shell

bundle 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top