我在1.9
模式下使用jruby
。irb不加載我創建的寶石
➜ nittresults git:(master) ✗ ruby -v
jruby 1.6.7.2 (ruby-1.9.2-p312) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java]
➜ nittresults git:(master) ✗ which gem
gem: aliased to jruby --1.9 -S gem
➜ nittresults git:(master) ✗ which irb
irb: aliased to jruby --1.9 -S irb
我創建了一個gem nittresults,安裝後我不能在irb中加載它。錯誤消息如下所示
➜ nittresults git:(master) ✗ gem list | grep -i nitt
nittresults (0.0.1)
➜ nittresults git:(master) ✗ irb
irb(main):001:0> require 'nittresults'
LoadError: no such file to load -- nittresults
from org/jruby/RubyKernel.java:1042:in `require'
from /Library/Frameworks/JRuby.framework/Versions/Current/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from (irb):1:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1197:in `catch'
from org/jruby/RubyKernel.java:1197:in `catch'
from /Library/Frameworks/JRuby.framework/Versions/Current/bin/jirb:13:in `(root)'
如何獲取它加載到irb中? 我在osx雪豹10.6.8上。
這裏是輸出OG gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.2 (2012-05-01 patchlevel 312) [java]
- INSTALLATION DIRECTORY: /Library/Frameworks/JRuby.framework/Gems/1.9
- RUBY EXECUTABLE: /Library/Frameworks/JRuby.framework/Versions/Current/bin/jruby
- EXECUTABLE DIRECTORY: /Library/Frameworks/JRuby.framework/Versions/Current/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-java-1.6
- GEM PATHS:
- /Library/Frameworks/JRuby.framework/Gems/1.9
- /Users/User/.gem/jruby/1.9
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri"
- "update" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
這裏是puts $:
➜ nittresults git:(master) ✗ irb
irb(main):001:0> puts $:
/Library/Frameworks/JRuby.framework/Versions/Current/lib/ruby/site_ruby/1.9
/Library/Frameworks/JRuby.framework/Versions/Current/lib/ruby/site_ruby/shared
/Library/Frameworks/JRuby.framework/Versions/Current/lib/ruby/site_ruby/1.8
/Library/Frameworks/JRuby.framework/Versions/Current/lib/ruby/1.9
=> nil
爲什麼你的1.9紅寶石裝載RubyGems的距離1.8?看看你的錯誤,路徑導致v1.8 rubygems ...這是不對的。 – Casper
我可以檢查哪些信息來解決這個問題? – nikhil
將'gem env'輸出添加到您的問題。你也有'GEM_HOME'或'GEM_PATH'環境變量定義('echo $ GEM_HOME $ GEM_PATH')嗎? – Casper