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/
Coul开发者_Go百科d 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}
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.
精彩评论