在代理后安装Bundler Gem

3
我在代理服务器后面安装bundler gem时遇到了问题。
$ gem install bundler --http-proxy http://my.proxy/proxy.pac:80
ERROR:  Could not find a valid gem 'bundler' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Not Found 404 (http://rubygems.org/latest_specs.4.8.gz)

$ rails -v
Rails 4.1.1

$ ruby --version
ruby 1.9.3p545 (2014-02-24) [i386-mingw32]

有什么建议可以解决这些错误吗?


你能获取其他的 gem 吗?还是这个问题只与 bundler 有关? - jkeuhlen
不行,我在尝试任何 gem 时都会遇到相同的错误。 - user3853136
你能通过其他方式访问互联网吗,比如使用 apt-get(假设你正在使用 Linux)? - jkeuhlen
我正在使用Windows 7 SP 1。 - user3853136
我遇到了“Ping请求无法找到主机http://rubygems.org”的问题。 - user3853136
我对在Windows上通过代理工作并不是很熟悉。在Linux上,我必须设置环境变量来强制这些类型的请求通过代理发送出去。 - jkeuhlen
3个回答

4

来自gem help install文档:

sudo gem install bundler -p http://myawesome.proxy.com:1234

2
尝试以下命令:
sudo HTTP_PROXY="http://10.3.100.207:8080" gem install bundler 将 "10.3.100.207" 替换为您的主机,将 "8080" 替换为您的端口值。
或者尝试以下命令:
sudo HTTP_PROXY="http://10.3.100.207:8080" 或 sudo export HTTP_PROXY="http://10.3.100.207:8080"
同时也要针对 https 和 HTTPS 进行操作,因为我曾经因此遇到过问题。

0

我认为 gem 不支持评估 .pac 文件。你需要直接提供正确的代理配置。


你说得对。但是我现在遇到了 407 错误: $ gem install bundler --http-proxy http://myusername:mypassword@my.proxy:8080 ERROR: Could not find a valid gem 'bundler' (>= 0) in any repository ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) bad response Proxy Authentication Required 407 (http://rubygems.org/latest_specs.4.8.gz) - user3853136
尝试使用环境变量,如https://dev59.com/x3VD5IYBdhLWcg3wXaUd#9382152中所述。 - Tim Moore

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接