尝试为Windows XP安装Ruby Gems时出现SocketError

时间:2013-01-21 11:55:50

标签: ruby windows-xp

我正在尝试安装nokogiriselenium-webdrivermechanize,但收到如下错误:

ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

C:\Documents and Settings\pp>gem install nokogiri
ERROR:  Could not find a valid gem 'nokogiri' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SocketError: getaddrinfo: No such host is known.  (http://rubygems.org/lates
t_specs.4.8.gz)

C:\Documents and Settings\pp>gem install nokogiri
ERROR:  Could not find a valid gem 'nokogiri' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SocketError: getaddrinfo: No such host is known.  (http://rubygems.org/lates
t_specs.4.8.gz)

C:\Documents and Settings\pp>gem install selenium-webdriver
ERROR:  Could not find a valid gem 'selenium-webdriver' (>= 0) in any repository

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SocketError: getaddrinfo: No such host is known.  (http://rubygems.org/lates
t_specs.4.8.gz)

C:\Documents and Settings\pp>gem install selenium
ERROR:  Could not find a valid gem 'selenium' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SocketError: getaddrinfo: No such host is known.  (http://rubygems.org/lates
t_specs.4.8.gz)

你能帮助我完成它吗?

1 个答案:

答案 0 :(得分:5)

您的错误似乎是代理问题, 尝试以下命令

gem install --http-proxy <your proxy host:port> <your gem name>

例如

gem install --http-proxy http://localhost:8888 selenium-webdriver

您也可以

SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT%

然后执行您的gem install