9

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!

gkocjan
  • 735
  • 7
  • 15

4 Answers4

19

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.

Paul
  • 1,188
  • 1
  • 11
  • 21
gkocjan
  • 735
  • 7
  • 15
3

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://git@github.com/bower/bower.git

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

Community
  • 1
  • 1
SyntaxRules
  • 2,056
  • 23
  • 32
  • I'm not a fan of installing unstable software. I recommend to downgrade to `bower@1.3.11` using `npm install -g bower@1.3.11`. – Fabio Poloni Mar 06 '15 at 14:07
1

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"
}
davidolrik
  • 414
  • 4
  • 10
1

For me it sufficed to add this single line to my (already existing) .bowerrc file:

{
   ...
   "https-proxy": "http://localhost:5865"
}

The solution from gkocjan did not work for me, I also had to add the value of my proxy (but maybe gkocjan didn't have a proxy).

I've also looked at the solution of SyntaxRules, but I already used the most recent and patched version of Bower. EDIT:I use version 1.3.12 of bower and 0.12.0 of node

Community
  • 1
  • 1
Goerp
  • 19
  • 4
  • I have problems in 1.3.9 version. Maybe in never version they change something – gkocjan Mar 16 '15 at 15:46
  • If I understand correctly, the bug mentioned in bower should be fixed in version 1.3.12, which I used. But I still got the same error you got. So I tried setting the proxy and that worked for me. Maybe for you it would help using version 1.3.12 of bower. – Goerp Mar 18 '15 at 09:54