无法在导轨 4.0.2 中加载"机械化"



在Rails Interactive shell(rails c)中,我遇到了一个错误,说:No such file to load -- Mechanize'我运行require 'mechanize'

奇怪的是,当我在Ruby Shell上输入require 'mechanize'irb)。

样本输出如下所示:

    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>'

问候

将其添加到gemfile

gem 'mechanize'

然后在shell上执行此命令

bundle 

相关内容

  • 没有找到相关文章

最新更新