avh4 / binwrap

Distribute binaries via npm
39 stars 17 forks source link

binwrap fails to install behind a corporate firewall (seems to ignore proxy settings) #47

Closed trs123 closed 4 years ago

trs123 commented 4 years ago

Hi, when trying to install elmi-to-json (for elm-spa) from behind a corporate firewall I get the following binwrap-install error:

$ npm i elmi-to-json
> elmi-to-json@1.3.0 install /home/trs/test-elm-spa/ri-elm/node_modules/elmi-to-json
> binwrap-install
ERR Error communicating with URL https://github.com/stoeffel/elmi-to-json/releases/download/1.3.0/elmi-to-json-1.3.0-linux.tar.gz Error: tunneling socket could not be established, statusCode=407
npm WARN our-elm-spa-app@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elmi-to-json@1.3.0 install: `binwrap-install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elmi-to-json@1.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

This only happens for binwrap-install. Other packages not using it can be installed without problems, so it is not a problem with my proxy settings. It seems that binwrap-install does not honor the proxy settings.

trs123 commented 4 years ago

This might be related to https://github.com/avh4/binwrap/pull/19#issuecomment-636322664

avh4 commented 4 years ago

elmi-to-json@1.3.0 uses binwrap@0.2.2, which uses the npm request package for HTTP. So you should be able to set environment variables as described here: https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables

For example:

HTTPS_PROXY="https://USERNAME:PASSWORD@10.0.0.1:8080/" npm i elmi-to-json

Does something like that work?

trs123 commented 4 years ago

The environment variables https_proxy and http_proxy had been set already but it seems that our VPN has changed (not sure if that is just an intermediate state or if it will stay that way), so I do not need to set them anymore and installing now works fine. I am quite confused now because I'm not sure when that happened and so cannot reproduce the original error anymore. Sorry about that. I'll close the issue for now and will reopen it if/when I encounter it again.