Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bower behind proxy - summary

I had problem with bower behind proxy, after running bower install i reveived error:

_http_client.js:73
    throw new TypeError('Request path contains unescaped characters.');

There are lots of topics, lots of solutions but no one work for me in 100% until now!

like image 751
gkocjan Avatar asked Jun 26 '14 14:06

gkocjan


3 Answers

The solution is very simple, and was in parts in many places. But let's begin!!

  1. Export proxy settings to env:

    export HTTP_PROXY=http://<proxy_url>:<port>
    export HTTPS_PROXY=http://<proxy_url>:<port>
    

    (if doesn't work use small letters: http_proxy, https_proxy)

  2. Create file ~/.bowerrc with content:

    {
        "strict-ssl": false,
        "registry": "http://bower.herokuapp.com",
        "https-proxy": ""
    }
    

    Last line is strange but very important! After I add it everything starts working!

I hope my post will help someone who spend hours searching for solution.

like image 147
gkocjan Avatar answered Sep 17 '22 20:09

gkocjan


This is an error with this version of bower. You can see the github issue here. The issue has been closed. This means your fix will be in the next version ( version > 1.3.12 ). If you can't wait update to the bleeding edge like so:

npm install -g git+https://[email protected]/bower/bower.git

If you don't like the method above see this answer for a how to install github repos via npm.

like image 43
SyntaxRules Avatar answered Sep 19 '22 20:09

SyntaxRules


I have my proxy configured in my environment, but @gkocjan's solution only fixed bower search for me.

To get bower install to work, I had to put it in my .bowerrc as well like so:

{
    "strict-ssl": false,
    "registry": "http://bower.herokuapp.com",
    "https-proxy": "http://127.0.0.1:8118"
}
like image 43
davidolrik Avatar answered Sep 19 '22 20:09

davidolrik