How to update gems in Ruby for Windows?

2019-02-03 17:26发布

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/

标签: ruby rubygems
1条回答
该账号已被封号
2楼-- · 2019-02-03 18:02

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 
查看更多
登录 后发表回答