如何在使用代理服务器访问Internet的Windows计算机上安装Rails? [英] How do I install rails on a Windows machine that uses a proxy server to get to the internet?

查看:42
本文介绍了如何在使用代理服务器访问Internet的Windows计算机上安装Rails?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是红宝石方式的忠实粉丝.但是今天,它妨碍了我.

I'm a big fan of the ruby way. However today it got in my way.

事实上,安装rails的方式(我在WinXP计算机上以域用户身份运行)是

The defacto way of installing rails (i'm running as a domain user on a WinXP machine) is

  • 下载并安装ruby(一键安装程序)
  • 在命令提示符下
  • 键入> gem安装导轨
  • download and install ruby (one-click installer)
  • type >gem install rails at the command prompt

第2步失败,因为某些功能getaddrhost无法运行.一些谷歌搜索人员告诉我这是一个已知问题-请参阅rubygems常见问题解答上的身份验证Windows代理问题

Step 2 fails with some function getaddrhost not able to function. Some googling taught me that this is a known issue - See Authenticating Windows Proxy Problems on the rubygems FAQ

那里建议使用的选项使用 -p -http-proxy http://proxy:port "进行gem install的开关也不起作用任何奇迹.

The suggested options there to "use the -p or --http-proxy http://proxy:port " switch for gem install also didn't work any wonders.

有一个指向运行服务器以跨代理服务器运行的对象的链接-但似乎需要安装python(?? !!).所以我很想念.

There's a link to something that runs a server to get across the proxy server - but it looked like it would need python to be installed (??!!). So I gave that a miss.

我将尝试获取.gem文件(在找出所有相互依存关系之后:()从 ruby​​_home \ lib \ ruby​​ \ gems \ 1.8 \ cache 上的我的rails-friendly中家用计算机并通过USB驱动器进行驱动,并在本地安装gem.是否有人能较轻松/快捷地弥合这种鸿沟?

I'm going to try to get the .gem files (after figuring out all the inter dependencies :( ) from ruby_home\lib\ruby\gems\1.8\cache on my rails-friendly home machine and USB-drive it across and do a local gem install. Does anyone have a less painful / quick way of bridging this divide?

更新:第二天好吧,我有本地可用的宝石.但是,如果我做

Update: Day2. Okay so I have the gems available locally. However if I do a

>gem install activesupport-1.4.4 --local
ERROR:  Error installing gem activesupport-1.4.4[.gem]: undefined method `includ
e?' for nil:NilClass

我曾经尝试单击ruby,然后单击186-27 RC2和186-26 Final版本的Windows安装程序.同样的问题.更多的谷歌搜索导致"在如果您在安装gem时遇到问题... ".最新的解决方法是:删除 gem env 所示的GEM PATH文件夹中的source_cache文件,然后执行 gem更新--system .并且代理服务器当然会进入第2步.

I've tried ruby once click installer for windows for 186-27 RC2 and 186-26 Final release. Same issue. More googling led to "In case you're having trouble installing gems...". The latest workaround is to: delete the source_cache file in your GEM PATH folder shown by gem env, then do a gem update --system. and of course proxy server gets in the way of Step 2.

我可以下载某些更高版本的宝石解决此问题吗?

Is this issue with gems fixed in some later release that I can download ?

推荐答案

又一场战斗以胜利告终.原来可以指定代理服务器.但是,出于某些原因,已记录在案的 -p -http-proxy 命令行开关不起作用,或者我不够聪明,无法找出正确的方法.

Well another battle ends.. with a victory. Turns out the proxy server can be specified after all. However the documented -p and --http-proxy command line switches don't work for some reason or I wasn't smart enough to figure out the right incantation.

>ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
>gem -v
1.3.5 
>gem query -p http
ERROR:  While executing gem ... (OptionParser::InvalidArgument)
    invalid argument: -p http

仅仅是尝试一切,我就可以尝试在Windows命令行上设置 HTTP_PROXY 环境变量,如WolfByte对

Just for trying everything I could I tried setting the HTTP_PROXY environment variable on the windows command line as mentioned in the WolfByte's answer to this SO question (that i stumbled upon after search keyword bingo on google). AND IT WORKED!!!

>SET HTTP_PROXY=http://username:password@proxy:port
>gem update --system
>gem install rails

猜猜SO需要一个新的标语"答案就在这里" ala XFiles.您只需要与Google搏斗即可.希望这对下一个人有帮助

Guess SO needs a new tag-line "The answer is in there" ala XFiles. You just need to wrestle with Google to get to it. Hope this helps the next person

这篇关于如何在使用代理服务器访问Internet的Windows计算机上安装Rails?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆