Creating a new rails 3 project over a proxy in windows

蹲街弑〆低调 提交于 2020-01-16 20:57:34

问题


My computer works on a proxy. So in order to install gems I use the following command

gem install -p http//#{proxy-server}:#{port} rails

If i use the normal gem install command, I get an error could not find gem. I installed rails 3.1 today and tried to create a new project. Half the way while creating the files, the generator started executing run bundle install and ended up giving the same error

Fetching source index for http://rubygems.org/
Could not reach rubygems repository http://rubygems.org/
Could not find gem 'turn (>= 0, runtime)' in any of the gem sources listed in your Gemfile.

The generator is trying to install some gems without proxy. How can I override this existing functionality? I want the generator to use gem install -p http//#{proxy-server}:#{port} #{gem} instead of gem install #{gem}


回答1:


Add the given option to your gemrc file

gem: -p http//#{proxy-server}:#{port}

Under unix this file is located under ~/.gemrc, for windows I don't know, but according to this answer should be

# Under windows XP
C:\Documents and Settings\All Users\Application Data\gemrc 
# Under Windows Vista/Seven
C:\ProgramData\gemrc for windows Vista/Seven

The rc file needs to be created if not present.



来源:https://stackoverflow.com/questions/7281047/creating-a-new-rails-3-project-over-a-proxy-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!