Development Tip

gem의 프록시 서버를 어떻게 설정할 수 있습니까?

yourdevel 2020. 10. 25. 13:12
반응형

gem의 프록시 서버를 어떻게 설정할 수 있습니까?


명령 프롬프트를 통해 SASS를 설치할 수 없습니다.

나는 아래 단계를 시도했다

c:\gem install sass

아래 오류가 발생합니다.

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)

제발 도와주세요


인증이 있거나없는 http / https 프록시의 경우 :

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

명령 프롬프트에 다음을 작성해야합니다.

set HTTP_PROXY=http://your_proxy:your_port

여기에 설명 된대로 http_proxyhttps_proxy환경 변수 를 추가해야합니다 .


@Yifei 답변 외에도. @, &, $와 같은 특수 문자 가있는 경우

당신은 함께 가야 퍼센트 인코딩 | 특수 문자를 인코딩 하십시오. 예를 들면 다음과 같습니다.

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

당신은 이것을 작성합니다 :

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

그래서 @으로 대체됩니다 %40.


당신은 시도 할 수 있습니다 export http_proxy=http://your_proxy:your_port


http_proxy 및 https_proxy를 설정할 때 프록시의 같은쪽에있는 URL에 대해 no_proxy가 필요할 수도 있습니다. https://msdn.microsoft.com/en-us/library/hh272656(v=vs.120).aspx


여기에있는 답변 중 어느 것도 실제로 제 경우에 도움이되지 않았습니다 (프록시 + 비밀번호). 대신 Github 문제에 대한 해결책을 찾았습니다.

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

기본적으로 세 가지 변수를 설정해야했습니다.

set http_proxy=proxy_ip:port
set http_proxy_user=user
set http_proxy_pass=password

참고 URL : https://stackoverflow.com/questions/22059670/how-can-i-set-a-proxy-server-for-gem

반응형