问题
I'm having trouble installing ruby gems. When I run
gem install compass
I get the following error
ERROR: Could not find a valid gem 'compass' (>= 0), here is why:
Unable to download data from https://rubygems.org/
- no such name (https://rubygems.org/latest_specs.4.8.gz)
Having tried to find the answer to this particular problem I can to the conclusion (with the help of google) that the fact I'm behind a corporate proxy is blocking the connection to Rubygems.org
So with a bit more googling I found this command that people have used to succesfully connect when behind a proxy
gem install compass --http-proxy=http://%USERNAME%:%PASSWORD%@%PROXY_SERVER%:%PROXY_PORT_NUMBER%
Having run this command substituting in the relevant information I'm not getting a different error.
ERROR: Could not find a valid gem 'compass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED:
No connection could be made because the target machine actively refused it.
- connect(2) (https://rubygems.org/latest_specs.4.8.gz)
I've had no luck finding what could be cuasing it, can anyone help?
Alternatively does anyone know of a way to install SASS and or Compass without using a Ruby CLI?
FYI I've tried a few SASS Preprocessor apps (PREPOS) and the compass app but we need specific versions of both SASS and COMPASS for this project and i can't seem to downgrade them.
Many thanks
回答1:
Try to use environment variables to set the proxies:
export http_proxy="http://user:pass@server.com:port"
export HTTP_PROXY="http://user:pass@server.com:port"
and then try to install the gem normally.
To test the proxy environment you can use cURL or wget:
curl -I http://stackoverflow.com
wget http://stackoverflow.com
Read this question if you want to know about the upper and lower case variable names.
回答2:
Try setting your HTTP_PROXY
and HTTPS_PROXY
environment variables. For example:
HTTP_PROXY=http://%USERNAME%:%PASSWORD%@%PROXY_SERVER%:%PROXY_PORT_NUMBER% gem install compass
来源:https://stackoverflow.com/questions/25626910/errnoeconnrefused-no-connection-could-be-made-because