2

我刚刚切换到 jRuby,并且能够安装我的 gem,但是当我尝试运行 rake 命令时,出现以下错误。如何告诉 jRuby 使用 nokogiri-1.6.0-java 而不是 nokogiri-1.6.0-x86-mingw32?

错误:

c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/spec_set.rb:9
2:in `block in materialize': Could not find nokogiri-1.6.0-x86-mingw32 in any of
 the sources (Bundler::GemNotFound)
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
spec_set.rb:85:in `map!'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
spec_set.rb:85:in `materialize'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
definition.rb:114:in `specs'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
definition.rb:159:in `specs_for'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
definition.rb:148:in `requested_specs'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
environment.rb:18:in `requested_specs'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
runtime.rb:13:in `setup'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler.
rb:120:in `setup'
        from c:/jruby-1.7.3/lib/ruby/gems/shared/gems/bundler-1.3.4/lib/bundler/
setup.rb:17:in `<top (required)>'
        from C:/Software/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_requir
e.rb:36:in `require'
        from C:/Software/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_requir
e.rb:36:in `require'
For a better pry experience, please use ansicon: http://adoxa.3eeweb.com/ansicon
/
the `ripper' lib is not supported on JRuby
rake aborted!
no such file to load -- ripper
org/jruby/RubyKernel.java:1027:in `require'
org/jruby/RubyKernel.java:1027:in `require'
org/jruby/RubyKernel.java:1027:in `require'
org/jruby/RubyKernel.java:1027:in `require'
org/jruby/RubyKernel.java:1027:in `require'
org/jruby/RubyArray.java:1613:in `each'
org/jruby/RubyArray.java:1613:in `each'
org/jruby/RubyKernel.java:1027:in `require'
org/jruby/RubyKernel.java:1046:in `load'
C:/Users/n0222072/AptanaWorkspace/dcms/config/application.rb:8:in `(root)'
C:/Users/n0222072/AptanaWorkspace/dcms/Rakefile:5:in `(root)'
org/jruby/RubyKernel.java:1046:in `load'
(See full trace by running task with --trace)
4

1 回答 1

0

它应该可以工作-我对Windows上的Ruby-ing不太熟悉,但这绝对是在PATH上同时拥有MRI和JRuby的问题-最重要的是互相弄乱了GEM_HOME / GEM_PATH(您可以检查从irb by running Gem.path) - 你需要隔离那些 - 确保它们指向正确的方向。

使用 JRuby 时不应加载此类内容 C:/Software/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb

也许总是使用bundle exec可能也会有所帮助,尽管我不确定它是否验证了错误GEM_HOME的后果

这就是为什么没有看到正确的 nokogiri 宝石的原因,因为它正在寻找错误的宝石,因为来自 MRI 的 custom_require.rb

于 2013-09-28T16:35:57.577 回答