74

I am unable to install SASS through command prompt.

I tried below steps

c:\gem install sass

I am getting below error:

ERROR:  Could not find a valid gem 'sass' (>= 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)

Please help me,

Ani Menon
  • 27,209
  • 16
  • 105
  • 126
user3358928
  • 749
  • 1
  • 6
  • 4

7 Answers7

147

For http/https proxy with or without authentication:

Run one of the following commands in cmd.exe

set http_proxy=http://your_proxy:your_port
set http_proxy=http://username:password@your_proxy:your_port
set https_proxy=https://your_proxy:your_port
set https_proxy=https://username:password@your_proxy:your_port
Yifei
  • 1,944
  • 1
  • 14
  • 20
  • 1
    How do I then remove these settings? – theonlygusti Feb 06 '16 at 11:19
  • 3
    @theonlygusti You don't need to remove them as these settings are only active within a command prompt window. If you close your command prompt window and reopen it you'll find out that you need to reenter the commands for it to work. – Anwuna Feb 09 '16 at 13:22
  • 1
    If want to clear the settings and don't want to close command prompt, use the following commands "set http_proxy=" and "set https_proxy=" – Aron Curzon Feb 10 '16 at 20:57
  • 3
    how to escape if password has a @ character – gaurav5430 Feb 15 '16 at 05:00
  • 1
    @gaurav5430: try `%40` – Marco Sulla May 26 '16 at 13:54
  • is there any way to use the windows login for this? – Julian Jun 30 '16 at 11:18
  • 5
    I don't know how this answer got those upvotes but it doesn't work for me. – ramazan polat Aug 11 '16 at 06:42
  • ok and how do I display the currently set proxy? echo %HTTP_PROXY% does nothing – McVitas May 09 '17 at 18:56
  • Also you can see actual environment proxy vars with: set http_proxy . If isn't setted it'll appear "Environment var http_proxy not defined. – albertoiNET Jul 12 '17 at 13:47
  • If also fetching from an internal location It's sometimes necessary to also set `no_proxy` to bypass the proxy for those subdomains / IP addresses. Note that parsing/behaviour around the `no_proxy` list is application-dependent and frequently inconsistent. – Ed Randall Oct 13 '21 at 08:52
19

You need to write this in the command prompt:

set HTTP_PROXY=http://your_proxy:your_port
mido
  • 24,198
  • 15
  • 92
  • 117
12

You need to add http_proxy and https_proxy environment variables as described here.

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
user3565373
  • 129
  • 4
  • Thanks, @TylerH. I checked on my personal laptop, and there was probably something about the fancy formatting that couldn't render in our enterprise – Ion Freeman Dec 24 '18 at 02:12
3

When setting http_proxy and https_proxy, you are also probably going to need no_proxy for URLs on the same side of the proxy. https://msdn.microsoft.com/en-us/library/hh272656(v=vs.120).aspx

Ion Freeman
  • 512
  • 4
  • 19
3

In Addition to @Yifei answer. If you have special character like @, &, $

You have to go with percent-encode | encode the special characters. E.g. instead of this:

http://foo:B@r@http-gateway.domain.org:80

you write this:

http://foo:B%40r@http-gateway.domain.org:80

So @ gets replaced with %40.

Ravi Parekh
  • 5,253
  • 9
  • 46
  • 58
2

You can try export http_proxy=http://your_proxy:your_port

DLight
  • 1,535
  • 16
  • 20
Vincent H Guyo
  • 356
  • 6
  • 24
2

None of the answers here actually helped my case (proxy + password), instead I found a solution on a Github issue:

https://github.com/rubygems/rubygems/issues/1068

Basically I had to set three variables:

set http_proxy=proxy_ip:port
set http_proxy_user=user
set http_proxy_pass=password
RolandASc
  • 3,863
  • 1
  • 11
  • 30