问题描述
我从 sudo bundle install 命令获得以下输出:
获取源索引`http:// rubygems.org /`
无法到达rubygems库`http:// rubygems.org /`
无法找到gem'rspec-rails(> = 2.0.0.beta .22,运行时)'在任何宝石来源。
我已经正确设置了$ http_proxy并且添加了 gem:--http-proxy =我的代理〜/ .gemrc。这些设置是让我的宝石命令工作,我希望他们会转化为捆绑,但没有这样的运气。
想想sudo可能不会继承我所有的我环境,我也将这些设置添加到我的root用户,但nada。
此时bundler阻止我部署我的应用程序,并且我可以找到很少其他人运行进入这个。如果没有人有答案,我将被迫从我的Rails应用中剥离bundler(我不介意这么做)。
export http_proxy = http:// user:密码@主机:端口
它工作正常。您是否使用 sudo
?如果是这样,默认 sudo
不会保留http代理。
请参阅此处以更正它:
I get the following output from the sudo bundle install command:
Fetching source index for `http://rubygems.org/`
Could not reach rubygems repository `http://rubygems.org/`
Could not find gem 'rspec-rails (>= 2.0.0.beta.22, runtime)' in any of the gem sources.
I have $http_proxy set correctly and I've added gem: --http-proxy=my proxy to ~/.gemrc. These settings are what allow my gem commands to work, and I was hoping they would translate to bundler, but no such luck.
Thinking sudo might not inherit my all of my environment, I also added those settings to my root user, but nada.
At this point bundler is preventing me from deploying my application, and I can find very few others running into this. If no one has an answer I will be forced to rip bundler out of my Rails app (which I wouldn't mind doing...)
I'm using Mac OS and just setting http_proxy in bash
export http_proxy=http://user:password@host:port
and it works fine. Did you use sudo
? If you do, by default sudo
does not preserve http proxy.
see here to correct it:
https://memset.wordpress.com/2010/10/14/bash-http_proxy-from-a-user-environment-to-sudo-one/
这篇关于如何在代理之后使用bundler?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!