Error installing Ruby gems

匿名 (未验证) 提交于 2019-12-03 02:33:02

问题:

Whilst installing Ruby gems I'm getting the following error:

ERROR:  Could not find a valid gem 'bundler' (>= 0), here is why:           Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT:  Failed to open TCP connection to api.rubygems.org:443 (A connection attempt fai led because the connected party did not properly respond after a period of time,  or established connection failed because connected host has failed to respond. - connect(2) for "api.rubygems.org" port 443) (https://api.rubygems.org/specs.4. 8.gz) 

Gems I've attempted to install:

  • Nokogiri
  • Mechanize
  • Bundler (Obviously)

All producing the same error, I'm guessing it's all the gems, not just bundler.

I've never seen this before so I'm not sure what to do, could someone tell me what's going on? It's probably worth mentioning that I am on a secure network.


UPDATE:

I've attempted to initialize a new rule in my firewall that will allow me to use TCP connection through port 443 (the port that gem install runs off of); However I'm still getting the error


UPDATE:

I've done some research and attempted to update using gem update --system via this resource. However it's still throwing the same error, and will not allow me to update

回答1:

I had the same problem recently and it was a proxy issue.

If you are on corporate network (work, university, dorm, etc.) probably you are too. Identify your proxy server information (see network settings) and try to add proxy info to your gem install command.

Depending on your gem version, one of these should work:

gem install --http-proxy http://[user]:[password]@[server]:[port] gem install -p http://[user]:[password]@[server]:[port] 

If that's your main net access, then you can set it to be used by default. Create .gemrc file in your home dir (user folder in windows or linux) and set the proxy settings there:

http_proxy: http://[user]:[password]@[server]:[port] 


回答2:

I'm not entirely sure what happened. However I was able to get onto another network and download gems.

There was no proxy, there was no VPN setup, but there was a default script so I'm guessing that had something to do with it.

So the resolution was I got onto a different network and successfully installed what I needed



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