"bower search" doesn't seem to work behind a proxy #208

Closed
aadrian opened this Issue Jan 17, 2013 · 26 comments

Comments

Projects
None yet

aadrian commented Jan 17, 2013

Doing a "bower search" doesn't seem to work under WinXP (32 bit) behind a proxy, even if NPM seems to work without problems.

IMHO this is a serious bug since it greatly limits the usage of bower: most companies do have proxies and firewalls :).

Owner

satazor commented Feb 2, 2013

bower is checking for process.env.HTTP_PROXY to check for the existence of a proxy. I think it should also check for HTTPS_PROXY. Anyway do you guys have those environment variables set?

$ node
> console.log(process.env)
Owner

sindresorhus commented Feb 2, 2013

@satazor We should document the proxy thing.

Owner

satazor commented Feb 2, 2013

@sindresorhus Agree, though the problem seems to be related to bower not reading the HTTPS_PROXY, thats why I asked @wellbo100 and @aadrian to print me their environment vars.

Owner

sindresorhus commented Feb 2, 2013

@satazor yes, this was OT, just thought i'd mention it, since it seems a lot of people are using Bower behind a proxy it would be good to document what's needed to make it work.

aadrian commented Feb 6, 2013

@satazor
http_proxy and https_proxy are not set in my env as variables. If I set them manually, than bower can fetch it's resources.

saden1 commented Feb 8, 2013

It seems this issue has to do with case sensitivity. If you set http_proxy and https_proxy they will not be picked up but if you set HTTP_PROXY and HTTPS_PROXY they will be picked up and bower works as expect.

Owner

satazor commented Feb 22, 2013

The standard seems to be uppercase. Does anyone know if this should be checked in a case insensitive way?

Owner

sindresorhus commented Feb 22, 2013

It does seem like the standard is uppercase, but people still do it in lowercase, which is why npm checks both...

Owner

satazor commented Feb 22, 2013

Alright, then source.js and package.js must account for this.

mehcode commented Feb 22, 2013

Quoting from the Open Group Base Specifications Issue 6 § 8.1, emphasis mine

[...] The name space of environment variable names containing lowercase letters is reserved for applications. Applications can define any environment variables with names from this name space without modifying the behavior of the standard utilities.

Lowercase is the standard for application-defined environment variables. However, upper-case is often the convention (and it is still acceptable just not recommended) so it does make sense to account for both.

Owner

wibblymat commented Feb 22, 2013

Possibly fixed by #269

Owner

satazor commented Feb 22, 2013

Yep, thanks @wibblymat

satazor closed this Feb 22, 2013

I'm still having this problem with bower. I've tried setting environment variables for HTTP_PROXY, http_proxy and confirming they're there by displaying them in the node console. Also tried installing different versions of node which allowed me to get bower --help working but search, install all result in the below error. npm works fine after been configured to the same proxy so the proxy is correct but with bower I get "tunneling socket could not be established"

bower error tunneling socket could not be established, cause=8952:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:683:

Owner

satazor commented Mar 14, 2013

That's rather strange, we are just passing the proxy definition to the request library.

I tried on a wireless network outside my firewall and it worked fine so it definitely seems to be an issue picking up the proxy setting. I had a similar problem with NPM when I first started using it but once I set the proxy through the NPM config it worked fine. I'll look into it some more to see why it doesn't seem to pick up the env var and will post anything I find out.

I do not know if this can help but I just encountered the same error. The cause was that I had the following config:
HTTP_PROXY=http://myproxy:8080/
HTTPS_PROXY=https://myproxy:8080/

This was an error because the proxy must be connected to in http even if the remote site is in https. With the following setting, bower connects to the proxy just fine:
HTTP_PROXY=http://myproxy:8080/
HTTPS_PROXY=http://myproxy:8080/

@jfaissolle AWESOME! I also had this problem with HTTPS_PROXY using https:// when it should have used http:// CHAMPION!

I struggled with this from behind a proxy so I thought I should post what I did. Above there is a comment saying one should set ALSO the HTTPS_PROXY pointing to the HTTP addess. This worked!

export HTTPS_PROXY=http://myproxy:port/

Thanks

pats commented Aug 6, 2013

Error still exists

c:\Dev\frontend>set HTTP_PROXY=http://192.168.2.30:3128 && set HTTPS_PROXY=http://192.168.2.30:3128 &
& bower install requirejs -V
bower requirejs#*           not-cached git://github.com/jrburke/requirejs.git#*
bower requirejs#*              resolve git://github.com/jrburke/requirejs.git#*
bower requirejs#*              ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/jrburke/requirejs.git", exit code of #128

Additional error details:
fatal: unable to connect to github.com:
github.com[0: 204.232.175.90]: errno=No error

Stack trace:
Error: Failed to execute "git ls-remote --tags --heads git://github.com/jrburke/requirejs.git", exit code of #128
    at createError (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\lib\util\createError.js:4:15)
    at ChildProcess.<anonymous> (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\lib\util\cmd.js:87:21)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)




Console trace:
Trace
    at StandardRenderer.error (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRenderer.js:69:17)
    at Logger.updateNotifier.packageName (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\bin\bower:113:18)
    at Logger.EventEmitter.emit (events.js:95:17)
    at Logger.emit (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\node_modules\bower-logger\lib\Logger.js:29:39)
    at C:\Users\user5\AppData\Roaming\npm\node_modules\bower\lib\commands\install.js:25:16
    at _rejected (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:713:24)
    at C:\Users\user5\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:739:30
    at Promise.when (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:979:31)
    at Promise.promise.promiseDispatch (C:\Users\user5\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:661:41)
    at C:\Users\user5\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:543:44

System info:
Bower version: 1.0.3
Node version: 0.10.13
OS: Windows_NT 6.1.7601 x64

c:\Dev\frontend>

my node setup see proxy env settings, and npm work ok

any suggestions?

Best regards,
PS

Owner

satazor commented Aug 6, 2013

@pats I've created #731

dmitriz referenced this issue in yeoman/yeoman Jan 15, 2014

Closed

Errors running `yo webapp` #1267

Bhakti commented Feb 3, 2014

hi bower team

My npm is working fine behind proxy after doing npm config set proxy and npm config set https-proxy

but my bower is not working behind proxy i tried setting environment variables HTTP_PROXY and HTTPS_PROXY like

HTTP_PROXY=http://{proxy.server}:{proxy:port}
HTTPS_PROXY=http://{proxy.server}:{proxy:port}

Also tried by adding domain userid password etc also any help will be great

Bhakti commented Feb 3, 2014

Error Trace is as follows

D:\bowerexample\app>bower search jQuery
bower error Request to https://bower.herokuapp.com/packages/search/jQuery failed: UNABLE_TO_VERIFY_LEAF_SIGNATURE

Stack trace:
Error: Request to https://bower.herokuapp.com/packages/search/jQuery failed: UNABLE_TO_VERIFY_LEAF_SIGNATURE
at createError (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\bower-registry-client\lib\util\createError.js:2:15)
at Request._callback (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\bower-registry-client\lib\search.js:114:29)
at self.callback (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\request\request.js:129:22)
at Request.EventEmitter.emit (events.js:95:17)
at Request.request.emit (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\bower-registry-client\node_modules\request-replay\index.js:69:33)
at ClientRequest.self.clientErrorHandler (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\request\request.js:239:10)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1547:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at SecurePair. (tls.js:1389:19)

Console trace:
Trace
at StandardRenderer.error (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRenderer.js:74:17)
at Logger.updateNotifier.packageName (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\bin\bower:109:18)
at Logger.EventEmitter.emit (events.js:95:17)
at Logger.emit (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\bower-logger\lib\Logger.js:29:39)
at C:\Users\145394\AppData\Roaming\npm\node_modules\bower\lib\commands\search.js:30:16
at _rejected (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:808:24)
at C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:834:30
at Promise.when (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:752:41)
at C:\Users\145394\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:574:44

System info:
Bower version: 1.2.8
Node version: 0.10.25
OS: Windows_NT 6.1.7601 ia32

Contributor

hemanth commented Feb 3, 2014

Do we need a process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; ?

Anyway @Bhakti The server you’re requesting a page from has misconfigured their SSL certificates! This is not an issue with bower AFAIK.

I ran into the same issue with HTTPS_PROXY needing to be set to use http instead of https, this should be fixed.

mdarif commented Sep 5, 2014

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment