programing tip

회사 프록시에 의해 차단 된 Bower 통화

itbloger 2020. 10. 11. 09:12
반응형

회사 프록시에 의해 차단 된 Bower 통화


웹 앱에 Bower를 사용하려고하는데 프록시 문제가 있습니다.

D:\>bower search jquery
bower retry         Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 1.2s
bower retry         Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 2.5s
bower retry         Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 6.8s
bower retry         Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 15.1s
bower retry         Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 20.3s
bower ECONNRESET    Request to https://bower.herokuapp.com/packages/search/jquery failed: tunneling socket could not be established, cause=Parse Error

관련 포인트 :

  • https://bower.herokuapp.com/packages/search/jquery이동 하면 전체 json 응답이 반환됩니다.
  • git : // 프로토콜과 http (s)를 사용하여 git을 사용하여 복제 할 수 있습니다.
  • 이러한 문제없이 NPM을 직접 사용할 수 있습니다.
  • Fiddler를 사용하여 차단되는 항목을 확인했지만 Bower 명령의 호출을 감지하지 못합니다. Fiddler에서 NPM 명령의 호출을 볼 수 있습니다.
  • Bower 문제 목록을 검색하고 비슷한 문제를 보았지만 해결책이 없거나 내 것과 완전히 같지 않은 것 같습니다.

어떤 아이디어?


감사합니다 @ user3259967

이것은 일을했다.

인증이 필요한 프록시 뒤에있는 경우 사용자 이름 / 암호를 .bowerrc 파일에 추가 할 수 있습니다 .

{
  "directory": "library",
  "registry": "http://bower.herokuapp.com",
  "proxy":"http://<USERNAME>:<PASSWORD>@<PROXY_IP>:<PROXY_PORT>/",
  "https-proxy":"http://<USERNAME>:<PASSWORD>@<PROXY_IP>:<PROXY_PORT>/"
}

https-proxy 에서 http : // 사용에 유의 하십시오.


나를위한 해결책은이 config .bowerrc입니다.

{
  "directory": "vendor",
  "registry": "http://bower.herokuapp.com",
  "proxy": "http://<user>:<pwd>@proxy.host.br:8080",
  "https-proxy": "http://<user>:<pwd>@proxy.host.br:8080",
  "strict-ssl": false
}

https-proxy에서 http 프로토콜을 사용하고 http 프로토콜이있는 레지스트리 항목을 사용합니다.

8080 포트 번호를 프록시 서버 포트로 변경해야합니다.


프록시 뒤에 있습니까?

HTTP_PROXY 및 HTTPS_PROXY 환경 변수를 설정 했습니까?

SET HTTP_PROXY=http://yourproxyserver:yourproxyport
SET HTTPS_PROXY=http://yourproxyserver:yourproxyport

.bowerrc에서 레지스트리 값을 변경해보십시오.

{
    "registry": "http://bower.herokuapp.com"
}

내 bower 설정을 구성 할 .bowerrc 파일이 없었습니다. defaults.js 라는 파일에있는 설정을 찾았습니다 . 아래에 "C : \ ... \ 이물 \ node_modules \ 이물-설정 \ lib 디렉토리 \ UTIL \ defaults.js "
나는이 다른 사람에게 도움이되기를 바랍니다 :

var defaults = {
    'cwd': process.cwd(),
    'directory': 'bower_components',
    'registry': 'http://bower.herokuapp.com',
    'shorthand-resolver': 'git://github.com/{{owner}}/{{package}}.git',
    'tmp': paths.tmp,
    'proxy': '<<http://user:pass@proxy:port>>',  // change proxy here or at the top
    'https-proxy': '<<http://user:pass@proxy:port>>',  // change proxy here or at the top
    'timeout': 30000,
    'ca': { search: [] },
    'strict-ssl': false,
    'user-agent': userAgent,
    'color': true,
    'interactive': null,
    'storage': {
        packages: path.join(paths.cache, 'packages'),
        links: path.join(paths.data, 'links'),
        completion: path.join(paths.data, 'completion'),
        registry: path.join(paths.cache, 'registry'),
        empty: path.join(paths.data, 'empty')  // Empty dir, used in GIT_TEMPLATE_DIR among others
    }
};

module.exports = defaults;


@thebignetGitHub에서 동일한 문제로 제안 할 수 있습니다.

설정 proxy, https-proxystrict-ssl로 구성 .bowerrc파일 :

{
  "proxy"       : "http://<host>:<port>",
  "https-proxy" : "http://<host>:<port>",
  "strict-ssl"  : false
} 

그러나 터미널에서 명령을 실행해야합니다.

git config --global url."https://".insteadOf git://

"strict-ssl": false

.bowerrc에서 나를 위해


들어 7 승 .

나를 위해 일한 것은 링크 에서 제안한 단계 아래 입니다. #nanowizard 답변을 읽으십시오.

  1. 에서 .bowerrc파일, 이전했을 수도있는 HTTP_PROXY / https_proxy를 설정을 제거합니다. 이것은 중요하다. 따라서이 파일의 최종 내용은 다음과 같아야합니다.

    {
      "directory": "app/bower_components" 
    }
    
  2. PC http_proxyhttps_proxy회사 방화벽 프록시에 환경 변수를 설정합니다 . 회사 프록시에 인증이 필요한 경우 암호에 특수 문자가 포함경우이 링크에서 제안하는대로 16 진수 형식 으로 변환 하십시오. 제 경우와 마찬가지로 '\'문자를 이스케이프해도 도움이되지 않았습니다. 또한 시스템을 다시 시작해야했습니다.

참고 : http_proxy 및 https_proxy는 아래와 같은 프록시 주소를 포함해야합니다.

http_proxy = http://<user>:<password>@<your company proxy>:<port>
https_proxy= http://<user>:<password>@<your company proxy>:<port>  ->Note no 's' in http://...

회사 방화벽 뒤에 있고 도메인 이름도 지정해야합니다. 이 답변 중 어느 것도 나를 위해 일하지 않았습니다. 내가 한 일은 다음과 같습니다.

  1. http://cntlm.sourceforge.net/ 에서 CNTLM을 다운로드했습니다 .
  2. 분명히 설치했습니다.
  3. cntml.ini를 열고 다음을 변경하십시오.

    your_domain_name 도메인

    your_domain_username 사용자 이름

    your_domain_passowrd 비밀번호

    PassLM 1AD35398BE6565DDB5C4EF70C0593492 (주석 제거)

    PassNT 77B9081511704EE852F94227CF48A793 (이 부분도 주석 해제)

    프록시 http : // localhost : 8888

  4. services.msc로 이동하여 CNTLM 인증 서비스를 시작하십시오.

  5. Fiddler 4/2 (그들이 부르는대로)를 다운로드하십시오.
  6. 이것도 설치하십시오. 이것은 http : // localhost : 8888 에서 실행됩니다 .
  7. 이제 실행중인 프로그램이 무엇이든 http : // locahost : 3128 (CNTLM이 실행중인 것입니다.)

In this case specify http.proxy and https.proxy as http://localhost:8888

This will work for other client programs. Just specify proxy as http://localhost:8888


its work for me to change in .bowerrc file

{
 "directory": "client/lib", 
 "registry": "http://bower.herokuapp.com",
 "proxy":"http://192.168.1.205:3228",
 "https-proxy":"http://192.168.1.205:3228"
}
  • where client/lib is installation directory where do you want to install
  • and http://192.168.1.205:3228 is your proxy ip with port. corporate proxy can be different according to oraganization.

In addition to setting the below proxy in .bowerrc:

{
  "directory": "app/bower_components",
  "proxy":"http://<user>:<password>@proxy.company.com:<proxy-port>",
  "https-proxy":"http://<user>:<password>@proxy.company.com:<proxy-port>",
  "http-proxy":"http://<user>:<password>@proxy.company.com:<proxy-port>",
  "strict-ssl": false,
  "registry": "http://bower.herokuapp.com"
}

I am required to run the following commands to fix the issue:

npm cache clean
bower cache clean
bower install

The registry used in the the other answers is now deprecated. Please update it!

{
  "proxy":"http://<user>:<password>@proxy.company.com:<proxy-port>",
  "https-proxy":"http://<user>:<password>@proxy.company.com:<proxy-port>",
  "registry": "https://registry.bower.io"
}

{
  "directory": "library",
  "registry": "http://bower.herokuapp.com",
  "proxy":"http://<USERNAME>:<PASSWORD>@<PROXY_IP>:<PROXY_PORT>/",
  "https-proxy":"http://<USERNAME>:<PASSWORD>@<PROXY_IP>:<PROXY_PORT>/"
}

This code worked for me. I am using Win 7 and chrome and also git bash. Here few things need to be cleared. This takes me huge time to find the actual data regarding the user name, password, proxy IP and Port. I will describe it step by step so that every learners can easily grasp the message:

  1. Create a file in the notepad named .bowerrc in the login folder; You can go there by typing at Start>Run>%UserProfile% and press OK.
  2. Type above code in the .bowerrc file with the following changes:

    Replace <USERNAME> with your internet connection user ID or login ID

    Replace <PASSWORD> with your internet connection password or login password.
    Replace <PROXY_IP> and <PROXY_PORT> with the working proxy IP address and its port number.

       **Note: There should be no angle brackets.**
    
  3. Proxy IP should be different than your own IP.

  4. Before using any proxy IP and port you should check it is working by changing your proxy IP and port.

  5. You can go through this link to know the details of proxy settings at description here

  6. From this proxy settings you will get Proxy IP and Port.
  7. Recheck all the input so that all are correct and save and close the file.
  8. Open git bash and change directory to the project file and type command and hit enter, in my case, git bash command:

a@a-PC MINGW32 /d/conFusion

$ bower install

  1. It worked like magic.

In case it helps someone, I had a 'bower blocked by group policy' error.

Solution was to make an exception in CryptoPrevent, a application installed on our company computers to prevent crypto lockers.


For info, in your .bowerrc file you can add a no-proxy attribute. I don't know since when it is supported but it works on bower 1.7.4 and it solve the issue of bower behind a corporate proxy with an internal repository

.bowerrc :

{
  "directory": "bower_components", 
  "proxy": "http://yourProxy:yourPort",
  "https-proxy":"http://yourProxy:yourPort",
  "no-proxy":"myserver.mydomain.com"
}

Regards


Please make sure there are no special characters in your proxy password. Convert it to hex. It works for me.

참고URL : https://stackoverflow.com/questions/21750804/bower-calls-blocked-by-corporate-proxy

반응형