rvm + jruby / gem install bundler - Errno :: ECONNREFUSED:连接被拒绝

时间:2011-04-02 11:17:45

标签: ruby jruby

尝试在jruby 1.6下安装一些宝石,但拒绝连接:

$ gem install bundler
ERROR:  Could not find a valid gem 'bundler' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - Connection refused (http://rubygems.org/latest_specs.4.8.gz)

DOH - 看起来像我的.gemrc中的鱿鱼的旧代理设置最终被拾起然后失败,因为鱿鱼没有运行:(


如果我切换回jruby 1.5.6或ruby 1.8 ......

,工作正常
$ rvm use jruby
Using /Users/kimptoc/.rvm/gems/jruby-1.6.0
$ gem list

*** LOCAL GEMS ***

rake (0.8.7)
sources (0.0.1)

任何线索都会受到赞赏。

$ rvm info

ruby-1.9.2-p136:

  system:
    uname:       "Darwin Chris-Kimptons-MacBook-Air.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.5.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p136"
    date:         "2010-12-25"
    platform:     "x86_64-darwin10.5.0"
    patchlevel:   "2010-12-25 revision 30365"
    full_version: "ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]"

  homes:
    gem:          "/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136"
    ruby:         "/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136"

  binaries:
    ruby:         "/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136/bin/ruby"
    irb:          "/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136/bin/irb"
    gem:          "/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136/bin/gem"
    rake:         "/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136/bin/rake"

  environment:
    PATH:         "/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136/bin:/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136@global/bin:/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136/bin:/Users/kimptoc/.rvm/bin:/Users/kimptoc/Documents/java/libs/torquebox-current/jruby/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/kimptoc/bin:/usr/local/mysql/bin"
    GEM_HOME:     "/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136"
    GEM_PATH:     "/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136:/Users/kimptoc/.rvm/gems/ruby-1.9.2-p136@global"
    MY_RUBY_HOME: "/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136"
    IRBRC:        "/Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

还在jruby网站上记录为错误 - http://jira.codehaus.org/browse/JRUBY-5683

Chris-Kimptons-MacBook-Air:temp kimptoc$ rvm ruby 'gem env && echo'
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.6
  - RUBY VERSION: 1.8.7 (2010-12-03 patchlevel 249) [java]
  - INSTALLATION DIRECTORY: /Users/kimptoc/.rvm/gems/jruby-1.5.6
  - RUBY EXECUTABLE: /Users/kimptoc/.rvm/rubies/jruby-1.5.6/bin/jruby
  - EXECUTABLE DIRECTORY: /Users/kimptoc/.rvm/gems/jruby-1.5.6/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - /Users/kimptoc/.rvm/gems/jruby-1.5.6
     - /Users/kimptoc/.rvm/gems/jruby-1.5.6@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-rdoc --no-ri"
     - "update" => "--no-rdoc --no-ri"
     - "gem" => "--http-proxy http://localhost:3128"
     - "bundle" => "--http-proxy http://localhost:3128"
     - "bundler" => "--http-proxy http://localhost:3128"
  - REMOTE SOURCES:
     - http://rubygems.org/

RubyGems Environment:
  - RUBYGEMS VERSION: 1.5.1
  - RUBY VERSION: 1.8.7 (2011-03-15 patchlevel 330) [java]
  - INSTALLATION DIRECTORY: /Users/kimptoc/.rvm/gems/jruby-1.6.0
  - RUBY EXECUTABLE: /Users/kimptoc/.rvm/rubies/jruby-1.6.0/bin/jruby
  - EXECUTABLE DIRECTORY: /Users/kimptoc/.rvm/gems/jruby-1.6.0/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - /Users/kimptoc/.rvm/gems/jruby-1.6.0
     - /Users/kimptoc/.rvm/gems/jruby-1.6.0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-rdoc --no-ri --env-shebang"
     - "update" => "--no-rdoc --no-ri --env-shebang"
     - "gem" => "--http-proxy http://localhost:3128"
     - "bundle" => "--http-proxy http://localhost:3128"
     - "bundler" => "--http-proxy http://localhost:3128"
  - REMOTE SOURCES:
     - http://rubygems.org/

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.4.3]
  - INSTALLATION DIRECTORY: /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302
  - RUBY EXECUTABLE: /Users/kimptoc/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302
     - /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "bundle" => "--http-proxy http://localhost:3128"
     - "gem" => "--http-proxy http://localhost:3128"
     - "bundler" => "--http-proxy http://localhost:3128"
  - REMOTE SOURCES:
     - http://rubygems.org/

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.5.0]
  - INSTALLATION DIRECTORY: /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330
  - RUBY EXECUTABLE: /Users/kimptoc/.rvm/rubies/ruby-1.8.7-p330/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330
     - /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "bundle" => "--http-proxy http://localhost:3128"
     - "gem" => "--http-proxy http://localhost:3128"
     - "bundler" => "--http-proxy http://localhost:3128"
  - REMOTE SOURCES:
     - http://rubygems.org/

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-12-25 patchlevel 136) [x86_64-darwin10.5.0]
  - INSTALLATION DIRECTORY: /Users/kimptoc/.rvm/gems/ruby-1.9.2-p136
  - RUBY EXECUTABLE: /Users/kimptoc/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/kimptoc/.rvm/gems/ruby-1.9.2-p136/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/kimptoc/.rvm/gems/ruby-1.9.2-p136
     - /Users/kimptoc/.rvm/gems/ruby-1.9.2-p136@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--http-proxy http://localhost:3128"
     - "bundle" => "--http-proxy http://localhost:3128"
     - "bundler" => "--http-proxy http://localhost:3128"
  - REMOTE SOURCES:
     - http://rubygems.org/


Chris-Kimptons-MacBook-Air:temp kimptoc$ gem update --system
Updating RubyGems
ERROR:  While executing gem ... (NoMethodError)
    undefined method `version' for nil:NilClass



Chris-Kimptons-MacBook-Air:temp kimptoc$ rvm install jruby
jruby-1.6.0 - #fetching 
jruby-1.6.0 - #extracted to /Users/kimptoc/.rvm/src/jruby-1.6.0 (already extracted)
Building Nailgun
jruby-1.6.0 - #installing to /Users/kimptoc/.rvm/rubies/jruby-1.6.0
ERROR: Cannot switch to 1.6.2 for this interpreter.
jruby-1.6.0 - #importing default gemsets (/Users/kimptoc/.rvm/gemsets/)
Copying across included gems
ERROR:  Could not find a valid gem 'jruby-launcher' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - Connection refused (http://rubygems.org/latest_specs.4.8.gz)

2 个答案:

答案 0 :(得分:2)

这听起来不像RVM问题。 RVM管理正在运行的Ruby,但它不应该触及gem安装的存储库信息。

输入rvm ruby 'gem env && echo'。每个安装Rubies的每个gem实例都将输出其环境信息。您可以比较它们以查看“REMOTE SOURCES”是否不同。远程源是宝石找到文件的地方。如果找不到宝石的那个不同,那么你就找到了问题。

您可能需要更新gem版本。您可以使用gem update --system执行此操作,rvm ruby 'gem update --system'执行所有这些操作。接下来,您可能希望rvm ruby 'gem clean rubygems-update'清除任何旧版本的gem。

答案 1 :(得分:1)

已弃用rvm旧命令而是使用以下命令:

rvm ruby 'gem env && echo'

rvm all do ruby gem clean rubygems-update