使用代理在Windows 7上安装gems的问题

Adi*_*Adi 8 ruby gem ruby-on-rails

我试图在代理后面的Windows 7上安装ruby.

我已经查看了各种论坛并成功设置了(我认为)http_proxy(见下文)

SET HTTP_PROXY=http:username:password@http://proxyhere.com:8080
Run Code Online (Sandbox Code Playgroud)

但是,我现在尝试安装gem时出现以下错误:

SocketError: getaddrinfo: No such host is known.
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Lui*_*ena 12

HTTP_PROXY语法必须是URI:

SET HTTP_PROXY=scheme://user:pass@host:port/path
Run Code Online (Sandbox Code Playgroud)

scheme可能是http或者https在某些情况下path可能缺席.

没有浏览器(或RubyGems)会接受您提供的URL作为有效URL.

所以在你的情况下:

SET HTTP_PROXY=http://username:password@proxyhere.com:8080/
Run Code Online (Sandbox Code Playgroud)

希望有所帮助


pet*_*ter 5

在工作中,我也有一个 proyx,SET HTTP_PROXY=http://proxyhere.com:8080在那里工作,所以不用用户名/密码试试。这取决于我假设的代理类型。

您还可以使用:

gem install --http-proxy http://proxyhere.com:8080 $gem_name
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅如何从代理后面更新 Ruby Gems (ISA-NTLM)