2010-06-30 23 views
3

另一個問題(這裏:)有我嘗試過的解決方案,但他們沒有工作。代理之後的RubyGems:InvalidArgument

我背後的代理工作,並不能弄清楚如何讓RubyGems通過它。

下面是一些輸出的幫助:

[email protected]:/etc$ export HTTP_PROXY=http://jkiehl:[email protected]:80/ 
[email protected]:/etc$ sudo gem i cucumber 
ERROR: http://rubygems.org/ does not appear to be a repository 
ERROR: Could not find a valid gem 'cucumber' (>= 0) in any repository 
[email protected]:/etc$ sudo gem i -p cucumber 
ERROR: While executing gem ... (OptionParser::InvalidArgument) 
    invalid argument: -p cucumber 
[email protected]:/etc$ sudo gem i -P cucumber 
ERROR: While executing gem ... (OptionParser::InvalidArgument) 
    invalid argument: -P 
[email protected]:/etc$ sudo gem i --http-proxy cucumber 
ERROR: While executing gem ... (OptionParser::InvalidArgument) 

任何想法?我很困惑。

回答

5

只需傳遞代理URL作爲--http-proxy參數即可。

sudo gem install --http-proxy http://jkiehl:[email protected]:80 cucumber 
+0

我以爲它在HTTP_PROXY var上運行...非常感謝! – 2010-06-30 16:03:47

+0

幫我一把。謝謝 – fletcher 2010-08-10 09:26:40

+0

它似乎需要這個答案中顯示的計劃,我試過'--http代理somebox',但沒有工作,但這樣做:'--http代理http:// somebox' – stefanB 2013-06-25 01:03:30

1

另一種方法是設置環境變量HTTP_PROXY,只要確保當U聲明它你ommit的HTTP://在代理URL,這樣的行會看起來像這樣

設置HTTP_PROXY = username:[email protected]:port

希望這會有所幫助