由于代理设置,捆绑命令无法正常工作

时间:2014-05-13 07:14:45

标签: ruby-on-rails proxy bundler

我有一个rails应用程序,我设置为使用代理,以便我可以更新我学校的局域网中的宝石。

但是现在我没有使用学校的网络,当我这样做时

 bundle install

我收到此错误

 Unfortunately, a fatal error has occurred. Please see the Bundler
 troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
 /home/me/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/uri/generic.rb:214:in `initialize': the scheme http does not accept registry part: cavs@students:cavsuon@proxy.uonbi.ac.ke:80 (or bad hostname?) (URI::InvalidURIError)

当我也这样做时

 gem update bundler

 gem update --system

我收到此错误

 ERROR:  While executing gem ... (URI::InvalidURIError)
the scheme https does not accept registry part: cavs@students:cavsuon@proxy.uonbi.ac.ke:80 (or bad hostname?

我不记得我是如何设置我的应用程序以使用代理的,但即使我做了它也从未工作过,所以我认为它从来没有使用代理。

如果我在学校的网络上,我怎样才能取消设置此代理配置并重新设置

做完

 echo $http_proxy

按照建议,我得到了

 http://cavs@students:cavsuon@proxy.uonbi.ac.ke:80

如何取消设置$ http_proxy

3 个答案:

答案 0 :(得分:0)

默认情况下,它可能正在拾取http_proxy环境变量。

尝试运行

echo $http_proxy
在命令行上

查看它给你的内容。您可以使用

设置该值
export http_proxy=http://user:password@host:port

如果这不起作用,也请查看HTTP_PROXY的设置。

您可以使用unset http_proxy暂时取消设置变量。如果您需要更加永久地更改(即每次打开终端时都存在),您需要检查主目录中的各种隐藏文件(即.profile或.bashrc)以查找并删除它。 / p>

答案 1 :(得分:0)

我遇到类似的问题,结果证明是Ruby itself中的问题:

  

问题与Ruby本身的uri组件有关   尝试匹配URI的userinfo部分

因此,在您的情况下,根据this,regexp不接受 @ 字符,您应修改 /usr/lib/ruby/1.8/ URI / common.rb

   -ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,]|#{escaped})*"
   +ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,@]|#{escaped})*"

答案 2 :(得分:0)

在命令行上运行export http_proxy=http://x.x.x.x:8080,然后使用echo $http_proxy检查是否已更改。这对我来说适用于2018年12月18日