在配置gem的过程中,有极小机率会遇到gem安装后失效的问题,比方说会403,如下所示:

C:\Users\geraldlau>gem update --system
Updating RubyGems...
ERROR:  While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 403

C:\Users\geraldlau>gem install rubygems-update
ERROR:  While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 403

C:\Users\geraldlau>gem sources -r http://gems.rubyforge.org
ERROR:  While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 403

 

这是一个很神奇的事情,所以说这个世界充满了奇妙。遇到这个问题,本地是无论如何都没法使用gem的了,只有去官方重新下载最新版的gem,本地安装后才能修复。

直接到http://rubyforge.org/frs/?group_id=126,下载最新版本的gem,然后本地安装。如果是win环境,建议拉zip包,若在linux下面,就随便拉哪种都行了。把gem包拉到本地并解压后,安装它:

C:\>cd rubygems-1.3.5

C:\rubygems-1.3.5>dir/w
驱动器 C 中的卷是 WIN7
卷的序列号是 5E56-471B

C:\rubygems-1.3.5 的目录

[.]                [..]               .autotest          .docume
[bin]              ChangeLog          cruise_config.rb   GPL.txt
History.txt        [lib]              LICENSE.txt        Manifes
[pkgs]             Rakefile           README             setup.r
[test]             [util]
              11 个文件        270,420 字节
               7 个目录 14,917,832,704 可用字节

C:\rubygems-1.3.5>setup.rb
RubyGems 1.3.5 installed

锘?== 1.3.5 / 2009-07-21

Bug fixes:

* Fix use of prerelease gems.
* Gem.bin_path no longer escapes path with spaces. Bug #25935 an

Deprecation Notices:

* Bulk index update is no longer supported (the code currently r
  the tests)
* Gem::manage_gems was removed in 1.3.3.
* Time::today was removed in 1.3.3.

----------------------------------------------------------------

RubyGems installed the following executables:
        c:/ruby/bin/gem

C:\rubygems-1.3.5>

 

至此,搞定它了