gkocjan
gkocjan

Reputation: 735

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!

Upvotes: 9

Views: 4535

Answers (4)

SyntaxRules
SyntaxRules

Reputation: 2206

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.

Upvotes: 3

gkocjan
gkocjan

Reputation: 735

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.

Upvotes: 19

Goerp
Goerp

Reputation: 19

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

Upvotes: 1

davidolrik
davidolrik

Reputation: 452

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"
}

Upvotes: 1

Related Questions