How to update gems in Ruby for Windows?

旧街凉风 提交于 2019-12-18 12:05:20

问题


I'm using Ruby's Command prompt. I cannot install any update, but internet navigation seems to be working.

I have no proxy here.

C:\Windows\System32>gem update activesupport
Updating installed gems
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SocketError: getaddrinfo: No such host is known.  (http://rubygems.org/latest_specs.4.8.gz)

What could be wrong?

Here is my environment:

C:\Ruby\bin>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby/lib/ruby/gems/1.9.1
     - C:/Users/wmj/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

回答1:


First run (with administrator privileges):

gem update --system

Then run the update for activesupport. I have that error one time, because i was behind a proxy, in that case, put:

gem update --http-proxy http://web.proxy.uri --system 


来源:https://stackoverflow.com/questions/5319212/how-to-update-gems-in-ruby-for-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!