如果我尝试在我的服务器上安装任何gem,那么我会得到302重定向,例如
gem install clickatell -V
GET http://rubygems.org/latest_specs.4.8.gz
302 Found
HEAD http://rubygems.org/specs.4.8.gz
connection reset after 2 requests, retrying
HEAD http://rubygems.org/specs.4.8.gz
302 Found
Run Code Online (Sandbox Code Playgroud)
一篇关于rubygems的文章建议做一个gem更新--system
http://help.rubygems.org/kb/rubygems/why-do-i-get-http-response-302-or-301-when-installing-a-gem
gem update --system -V
Updating RubyGems
GET 302 Found: http://gems.rubyforge.org/latest_specs.4.8.gz
connection reset after 2 requests, retrying
HEAD 302 Found: http://gems.rubyforge.org/specs.4.8.gz
connection reset after 2 requests, retrying
HEAD 302 Found: http://gems.rubyforge.org/yaml
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEDOUT: Connection timed out - connect(2) (http://gems.rubyforge.org/yaml)
Run Code Online (Sandbox Code Playgroud)
这当然只是宝石本身的更新.
我正在运行rubygems 1.3.1最新版本是1.6.1
有没有办法可以更新Rubygems而不会陷入我的302重定向陷阱.
问候,
凯文.
我设法用更新rubygems
gem update --system -l -V --source http://production.cf.rubygems.org
Updating RubyGems
GET http://production.cf.rubygems.org/latest_specs.4.8.gz
200 OK
Updating rubygems-update
Installing gem rubygems-update-1.6.1
Using local gem /home/passenger/.rvm/gems/ruby-1.8.7-p249/cache/rubygems-update-1.6.1.gem
Run Code Online (Sandbox Code Playgroud)
这并没有解决我在任何其他宝石上遇到的302错误.
要直接安装gem,您可以按照以下步骤操作:
1. go to http://rubygems.org/, search for 'your-gem', and copy the link
2. wget http://rubygems.org/downloads/your-gem.gem
3. gem install ./your-gem.gem --local
Run Code Online (Sandbox Code Playgroud)