npm installer fails on proxy and certificates
catinthetap opened this issue ยท 5 comments
When I attempt to use the npm installer for Elm (on CentOS7):
npm install -g elm
(as per https://www.npmjs.com/package/elm)
I get the following error:
> > elm@0.18.0 install /home/dev/.nvm/versions/node/v6.11.3/lib/node_modules/elm
> > node install.js
>
> Error communicating with URL https://dl.bintray.com/elmlang/elm-platform/0.18.0/linux-x64.tar.gz Error: unable to get local issuer certificate
> npm ERR! Linux 3.10.0-693.17.1.el7.x86_64
> npm ERR! argv "/home/dev/.nvm/versions/node/v6.11.3/bin/node" "/home/dev/.nvm/versions/node/v6.11.3/bin/npm" "install" "-g" "elm"
> npm ERR! node v6.11.3
> npm ERR! npm v3.10.10
> npm ERR! code ELIFECYCLE
>
> npm ERR! elm@0.18.0 install: `node install.js`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the elm@0.18.0 install script 'node install.js'.
> npm ERR! Make sure you have the latest version of node.js and npm installed.
> npm ERR! If you do, this is most likely a problem with the elm package,
> npm ERR! not with npm itself.
> npm ERR! Tell the author that this fails on your system:
> npm ERR! node install.js
> npm ERR! You can get information on how to open an issue for this project with:
> npm ERR! npm bugs elm
> npm ERR! Or if that isn't available, you can get their info via:
> npm ERR! npm owner ls elm
> npm ERR! There is likely additional logging output above.
>
> npm ERR! Please include the following file with any support request:
> npm ERR! /home/dev/projects/assessment-service/npm-debug.log
I have attached the npm-debug-log file:
npm-debug.log
One of my colleagues suggested this workaround:
wget https://dl.bintray.com/elmlang/elm-platform/0.18.0/linux-x64.tar.gz
sudo tar -zvxf linux-x64.tar.gz --strip-components=1 -C /usr/local/bin
and that was successful. He had a look at the issue and suggest that cause might be this:
We configure NPM to use a root certificate of the proxy
The ELM install script downloads a file from the internet but does not pass proxy configuration OR certificate configuration from NPM
So I think it is a bug in the ELM package install.js - specifically this:
https://github.com/elm-lang/elm-platform/blob/master/installers/npm/install.js#L27
My colleague believes the workaround is successful because wget will honor the https_proxy / HTTPS_PROXY environment variable
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
This worked for me
NODE_TLS_REJECT_UNAUTHORIZED="0" npm install -g elm
JordyMoos suggestion of using NODE_TLS_REJECT_UNAUTHORISED="0" works fine but a) it seems like more of a work-around than a fix and b) I couldn't find it on the npmjs.com page for Elm. I'm concerned it will put off people less obsessive than me! ;-)
We need a way to work around a corporate firewall as well. If there were a way to provide a custom binary host URL, that would be great for us. Otherwise, we'll have to hack a bunch of other packages that require a elm as an NPM dependency.
The system has all the necessary certs installed to allow things to work with our Corporate MITM proxy here, but for some reason, this operation does not use those certificates, and so I also had to disable the TLS verification :(
The right solution is to fix the install.js so it honors system certificates.