Atom compile behind corporate firewall: npm https header


#1

Hi All,

I am trying to compile behind a corporate firewall without root mojo on an older linux distro and I would really appreciate some help from the community. I am pretty sure I have done my due diligence and reviewed the related issues discussed here (322 and many others).

I expect my problem has to do with npm handling https headers in a way that does not comply with what my corporate proxy expects (more details below). We have an older distro deployed (RHEL6) which supports glibc 2.12. This is too old to be able to use the compiled versions of atom which I believe require glibc > 2.14. I understand one option using glibc backward compatibility would be to compile newer revs of glibc and related runtime libs, and then edit the released binary to point to them instead of locations in /lib64. I could not get this to work but I am not experienced with that operation. If anyone could assist with this I would like to try. I also considered running a RHEL7 VM outside the firewall, and using glibc-compat to build (cross compile?) a RHEL6 exec to run inside the firewall.

I have tried to compile with different versions of node and npm (from 0.10.31/1.4.23 to 5.0.0.rc1/3.39). I am using cntlm to get through the proxy, and I have verified that the proxy works for both http and https using wget.

I am trying to compile the 1.0.19 version of atom, but I have also tried older revs. One thread discussed installing a old version of atom using an old version of npm, and then using apm to upgrade (link). I could not get this to work.

I have cntlm listening on port 3128 for http proxy, and port 3129 for https.

$ATOM/build/.npmrc:

cache = ~/.atom/.npm
proxy=http://localhost:3128
https-proxy=https://localhost:3129
registry=http://registry.npmjs.org
strict-ssl=false

I see the failure pretty early, and the verbose log from cntlm for https has a bunch of errors like:

HEAD: ?headers_recv: Unknown header (?).

and I see errors in the build console like (note URLs obfuscated since new users can only post 2 links):

./script/build
Node: v0.10.31
npm: v1.4.23
Installing build modules…
npm ERR! fetch failed https atom.io/download/atom-shell/nan-1.6.1.tgz
npm ERR! fetch failed https registry.npmjs.org/chalk/-/chalk-1.0.0.tgz
npm ERR! fetch failed https registry.npmjs.org/grunt/-/grunt-0.4.5.tgz
npm ERR! fetch failed https registry.npmjs.org/grunt-nsp-shrinkwrap/-/grunt-nsp-shrinkwrap-0.0.3.tgz
npm ERR! fetch failed https registry.npmjs.org/npm-shrinkwrap/-/npm-shrinkwrap-5.3.0.tgz
npm ERR! fetch failed https registry.npmjs.org/promise/-/promise-7.0.0.tgz
npm ERR! fetch failed https registry.npmjs.org/standard/-/standard-3.7.0.tgz
npm ERR! fetch failed https registry.npmjs.org/text-table/-/text-table-0.2.0.tgz
npm ERR! fetch failed https registry.npmjs.org/standard-format/-/standard-format-1.3.6.tgz
npm ERR! fetch failed https atom.io/download/atom-shell/nan-1.6.1.tgz
npm ERR! fetch failed https registry.npmjs.org/grunt/-/grunt-0.4.5.tgz
npm ERR! fetch failed https registry.npmjs.org/chalk/-/chalk-1.0.0.tgz
npm ERR! fetch failed https registry.npmjs.org/grunt-nsp-shrinkwrap/-/grunt-nsp-shrinkwrap-0.0.3.tgz
npm ERR! fetch failed https registry.npmjs.org/npm-shrinkwrap/-/npm-shrinkwrap-5.3.0.tgz
npm ERR! fetch failed https registry.npmjs.org/promise/-/promise-7.0.0.tgz
npm ERR! fetch failed https registry.npmjs.org/standard/-/standard-3.7.0.tgz
npm ERR! fetch failed https registry.npmjs.org/text-table/-/text-table-0.2.0.tgz
npm ERR! fetch failed https registry.npmjs.org/standard-format/-/standard-format-1.3.6.tgz
npm ERR! fetch failed https atom.io/download/atom-shell/nan-1.6.1.tgz
npm ERR! network tunneling socket could not be established, cause=read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’

Note that with the newer versions of node/npm, I see exactly the same issue:

./script/build
Node: v5.0.0
npm: v3.3.9

With this approach the $ATOM/build/node-modules directory is never even created, so the installation doesn’t get that far. Again, I think the issue has something to do with the way npm handles the headers. I know that cntlm has a Header option to remap headers, so I was thinking maybe that could be used to get around this issue. I did find some discussion of this (long form obfuscated link since new users are restricted to 2: stackoverflow.com/questions/18569054/npm-behind-ntlm-proxy), and they recommend setting the cntlm configuration file as below, but this had no impact for my problem.

Header Connection: close

As an aside, I am a complete JS newb, and I would very much like to know how to make the install be more verbose, for example set --loglevel=“info”.

Thanks in advance for any time you can spare.


#2

I wanted to bump this back up to see if anyone had suggestions. TIA


#3

I’m still experiencing the same issue on OS X.

I set my proxy via env variable, .apmrc, npm and apm.

in .zshrc:
export http_proxy=http://proxy:80
export https_proxy=https://proxy:80

in .apmrc:
http-proxy=http://proxy:80
https-proxy=https://proxy:80
strict-ssl=false

apm:
apm config set proxy http://proxy:80
apm config set https_proxy proxy http://proxy:80

I still get the following error from Atom:

tunneling socket could not be established, cause=read ECONNRESET