Help us understand the problem. What is going on with this article?

Proxy環境でgem install

More than 5 years have passed since last update.

gem installはProxy環境でエラーが出る

学校でSassをインストールしようとしたら、プロキシのせいでエラーが出る。
環境は以下の通り。

  • OS:Windows8
  • msysgit
  • Ruby 2.0.0p451
  • gem 2.2.2

エラーメッセージ

$ gem install sass
ERROR:  Could not find a valid gem 'sass' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT:
 A connection attempt failed because the connected party did not properly respon
d after a period of time, or established connection failed because connected hos
t has failed to respond. - connect(2) (https://api.rubygems.org/latest_specs.4.8
.gz)

対応策

参考:プロキシが邪魔してRubyGemでインストールできないとき

概ねリンク先の通りですが、ユーザー名とパスワードが必要だったので以下のように入力。

$ gem install パッケージ名 -r -p http://username:password@proxy.hostname:port

これでOK。
※1 username,password,proxy.hostname,portなどはご自身の環境に合わせて変更してください。
※2 ユーザ名に@を含む場合、エスケープする必要があるそうです
(参考:gem install実行時、Proxyサーバ認証ユーザに @ を含む場合のTips

wakaba260
Webエンジニア - Vim, Ruby, ansible, docker
aiming
オンラインゲームの企画・プロデュース・開発・運営を行う会社。Web+Game+リアルタイム通信技術に力を入れています!
http://aiming-inc.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした