Bower calls blocked by corporate proxy

前端 未结 16 1173
夕颜
夕颜 2020-11-30 20:00

I\'m trying to use Bower for a web app, but find myself hitting some sort of proxy issues:

D:\\>bower search jquery
bower retry         Request to https:/         


        
相关标签:
16条回答
  • 2020-11-30 20:50

    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
    
    0 讨论(0)
  • 2020-11-30 20:51

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

    0 讨论(0)
  • 2020-11-30 20:52

    For Win 7.

    What worked for me , are below steps as suggested at this link - read #nanowizard answer.

    1. In .bowerrc file, remove any http_proxy / https_proxy settings that you might have done earlier. This is important. So final content of this file should look like :-

      {
        "directory": "app/bower_components" 
      }
      
    2. Set environment variables in your pc - http_proxy and https_proxy to your corporate firewall proxy. In case, your corporate proxy requires authentication and if your password contains special characters, convert it to hex form as suggested by this link. As in my case escaping of characters with '\' did not help. Also I had to restart my system.

    Note : http_proxy and https_proxy should contain same proxy address as shown below

    http_proxy = http://<user>:<password>@<your company proxy>:<port>
    https_proxy= http://<user>:<password>@<your company proxy>:<port>  ->Note no 's' in http://...
    
    0 讨论(0)
  • 2020-11-30 20:53

    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"
    }
    
    0 讨论(0)
  • 2020-11-30 20:56

    Thanks @user3259967

    This did the job.

    I would like to add that if you are behind a proxy that needs to be authenticated, you can add the username/password to your .bowerrc file.

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

    NOTICE the use of http:// in https-proxy

    0 讨论(0)
  • 2020-11-30 20:56

    you can try suggest @thebignet into same issue on GitHub

    Set proxy, https-proxy and strict-ssl configuration into .bowerrc File :

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

    But you must run Command from terminal:

    git config --global url."https://".insteadOf git://
    
    0 讨论(0)
提交回复
热议问题