2
在導軌交互式外殼程序(rails c
)中,出現如下錯誤:No such file to load -- Mechanize'
當我運行require 'mechanize'
時。無法在導軌中加載'mechanize'4.0.2
奇怪的是,我在紅寶石外殼(irb
)上輸入require 'mechanize'
時沒有出現任何錯誤。
示例輸出如下所示:
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>'
問候
你已殼執行此命令添加寶石「機械化」到你的寶石文件正確嗎? – rainkinz