LoginSignup
66
66

More than 5 years have passed since last update.

Proxy環境でgem install

Last updated at Posted at 2014-05-09

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

66
66
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
66
66