使用RVM在JRuby中安装gems时出现问题

时间:2014-05-17 07:11:54

标签: ruby rubygems rvm jruby

我正在使用Linux Mint。我已经安装了jruby和jdk。

当我查看ruby版本时,它会给我正确的消息

ruby -v jruby 1.7.11 (1.9.3p392) 2014-02-24 86339bb on Java HotSpot(TM) Server VM 1.8.0_05-b13 +indy [linux-i386]

但是当我尝试安装这样的宝石时:

gem install bundler

它给了我这样的信息:

ERROR: While executing gem ... (SocketError) recv: name or service not known

哪个jruby /home/msdc/.rvm/rubies/jruby-1.7.11/bin/jruby

哪个宝石

/home/msdc/.rvm/rubies/jruby-1.7.11/bin/gem

gem env

RubyGems Environment: - RUBYGEMS VERSION: 2.2.2 - RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 392) [java] - INSTALLATION DIRECTORY: /home/msdc/.rvm/gems/jruby-1.7.11 - RUBY EXECUTABLE: /home/msdc/.rvm/rubies/jruby-1.7.11/bin/jruby - EXECUTABLE DIRECTORY: /home/msdc/.rvm/gems/jruby-1.7.11/bin - SPEC CACHE DIRECTORY: /home/msdc/.gem/specs - RUBYGEMS PLATFORMS: - ruby - universal-java-1.8 - GEM PATHS: - /home/msdc/.rvm/gems/jruby-1.7.11 - /home/msdc/.rvm/gems/jruby-1.7.11@global - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - "install" => "--no-rdoc --no-ri --env-shebang" - "update" => "--no-rdoc --no-ri --env-shebang" - REMOTE SOURCES: - https://rubygems.org/ - SHELL PATH: - /home/msdc/.rvm/gems/jruby-1.7.11/bin - /home/msdc/.rvm/gems/jruby-1.7.11@global/bin - /home/msdc/.rvm/rubies/jruby-1.7.11/bin - /usr/local/sbin - /usr/local/bin - /usr/sbin - /usr/bin - /sbin - /bin - /usr/games - /home/msdc/bin - /usr/local/java/jdk1.8.0_05/bin - /home/msdc/bin - /usr/local/java/jdk1.8.0_05/jre/bin - /home/msdc/bin - /usr/local/java/jdk1.8.0_05/bin - /home/msdc/bin - /usr/local/java/jdk1.8.0_05/jre/bin - /home/msdc/.rvm/bin

当我在调试模式下运行gem install bundler时,它给了我:

/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:775:in `recv_reply'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:663:in `request'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:511:in `each_resource'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:0:in `resolv'
org/jruby/RubyArray.java:1613:in `each'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:1026:in `resolv'
org/jruby/RubyArray.java:1613:in `each'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:1025:in `resolv'
org/jruby/RubyArray.java:1613:in `each'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:1023:in `resolv'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:503:in `each_resource'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/resolv.rb:480:in `getresource'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/remote_fetcher.rb:88:in `api_endpoint'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/source.rb:42:in `api_uri'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/source.rb:170:in `load_specs'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/spec_fetcher.rb:265:in `tuples_for'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/spec_fetcher.rb:226:in `available_specs'
org/jruby/RubyArray.java:1613:in `each'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/source_list.rb:97:in `each_source'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/spec_fetcher.rb:222:in `available_specs'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/spec_fetcher.rb:102:in `search_for_dependency'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/dependency_installer.rb:216:in `find_gems_with_sources'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/dependency_installer.rb:292:in `find_spec_by_name_and_version'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/dependency_installer.rb:166:in `available_set_for'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/dependency_installer.rb:418:in `resolve_dependencies'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/dependency_installer.rb:371:in `install'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/commands/install_command.rb:219:in `install_gem'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/commands/install_command.rb:263:in `install_gems'
org/jruby/RubyArray.java:1613:in `each'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/commands/install_command.rb:259:in `install_gems'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/commands/install_command.rb:171:in `execute'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/command.rb:305:in `invoke_with_build_args'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/command_manager.rb:167:in `process_args'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/command_manager.rb:137:in `run'
/home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/gem_runner.rb:54:in `run'
/home/msdc/.rvm/rubies/jruby-1.7.11/bin/jgem:21:in `(root)'
org/jruby/RubyKernel.java:1101:in `load'
/home/msdc/.rvm/rubies/jruby-1.7.11/bin/gem:4:in `(root)'

异常`Gem :: SystemExitException' at /home/msdc/.rvm/rubies/jruby-1.7.11/lib/ruby/shared/rubygems/user_interaction.rb:381 - 使用exit_code 1退出RubyGems

1 个答案:

答案 0 :(得分:0)

我建议尝试http://rubygems.org并查看是否有效。 https应该可以工作,但至少你会更准确地知道问题是什么。您可能会在〜/ .gemrc文件中找到此配置信息。