紅寶石1.9.2p320 軌3.0.8 Fedora發行16(凡爾納)爲什麼我可以使用irb的RMagick而不使用rails控制檯?
做的:
百勝安裝ImageMagick的 百勝安裝的ImageMagick-devel的 寶石都
,沒有任何問題安裝RMagick我可以從獨立的Ruby程序運行RMagick,但Ruby in Rails(使用 相同的解釋器)找不到RMagick:
gremlin:eric cars01 $ irb irb(main):001:0> require 'RMagick' => true irb(main):002:0> Magick::Version => "RMagick 2.13.1" irb(main):003:0> $".grep(/Magick/) => ["/usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/lib/RMagick2.so", "/usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/lib/RMagick.rb"] irb(main):004:0> gremlin:eric cars01 $ rails console Loading development environment (Rails 3.0.8) irb(main):001:0> require 'rubygems' => nil irb(main):002:0> require 'RMagick' LoadError: no such file to load -- RMagick from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `block in require' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `block in load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596:in `new_constants_in' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225:in `load_dependency' from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239:in `require' from (irb):2 from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.8/lib/rails/commands/console.rb:44:in `start' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.8/lib/rails/commands/console.rb:8:in `start' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.8/lib/rails/commands.rb:23:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `'
如果我將RMagick放入Gemfile中,無論是否帶有版本,捆綁軟件都會說它 找不到機器上的寶石。但它適用於其他寶石。
任何人都有任何想法,爲什麼Ruby可以加載RMagick之外的Rails,但不是在它?
同時,在加載之前,將路徑推送到$ RMagick的超酷解決方法工作正常。
由於xdite在下面指出,這是因爲'rails console'使用了不同的gem環境。嘗試運行'bundle exec irb'進行更適合的比較。 – 2012-07-09 08:31:25
當然。問題是我無法獲得捆綁包來在供應商/緩存中創建RMagick gem。有什麼建議麼? – Eric 2012-07-09 17:32:53