-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nodejs 4 introduces UNABLE_TO_GET_ISSUER_CERT_LOCALLY error for users behind company firewalls #3742
Comments
|
If you get that error, it's most likely an issue with your proxy. The error itself just means that a TLS certificate in the chain is signed by an unknown CA, presumably the cert your proxy uses. v4.x and v5.x are more strict than v0.12 is but most people would consider that a good thing. |
@bricss, Yup, tried that & also always-auth=false. Doesn't help but thanks for the suggestion. |
@bnoordhius, yes, starting in v4.x my understanding is that we'll need to configure the cafile to include our company certificate chain. I've done that using npm like this:
mycacert.pem is a file containing multiple PEM formated X509 certificates in this form:
I also tried setting an array of CAs following the documentation here: https://docs.npmjs.com/misc/config. With the log level turned up to silly level.
this is the first error I get
My guess is that either our root or intermediate certificate isn't getting passed to openSSL. I don't see any errors about a load failing or invalid format. I modified npm\lib\config\load-cafile.js to confirm it was being called & loading my cafile. beyond that I haven't dug into the code. More error output would helpful. Is there a way to view debug statements from the openssl module being used by node? Thanks |
That's because node-gyp doesn't use npm's proxy settings, or at least not the cafile settings. A pull request to node-gyp honoring Alternatively, if you accept the risks, |
@bnoordhuis thanks for the info! We are talking through our options. |
@bnoordhuis do you know if this was ever raised? |
@voltagex I don't believe so. |
we are still interested in a fix for this. We are still using Nodejs v0.12 |
PR to node-gyp: nodejs/node-gyp#844 Mentioning the below for all the people trying to 'npm install' other things and getting similar errors, and google is turning this issue as a result:FYI, depending on what you're trying to install, it's possible that a module itself is being bad about ssl/cafiles. electron-prebuilt is a great example. It has an install.js script that sets up a download of a file, and then it doesn't check for any configuration. Even worse, electron-download checks for a "strictSSL" option, but electrion-prebuilt doesn't pass one. TLDR: your problems with self-signed certificates may not be related to npm or node-gyp: but using npm may be how you experience that error. |
Thank you @bricss! Worked like a charm |
is there reason to keep this one open? |
@bricss, yes that work for me as well.. cheers |
I'm behind a corporate HTTPS proxy.
To pass behond this issue I have to set configuration to use the cafile
The only workaround is
|
Just adding my experiences with this issue. I was hitting this problem when trying to install the dependencies for the angular2 quickstart. I am also behind a proxy and started by trying to set the proxy settings and The error I saw was being generated during a postinstall 'typings install` command:
I ended up having to add .typingsrc file at the same location as my .npmrc file with the following lines added: proxy=http://proxy.address:proxy.port This got me past the This may not be relevant, but thought I'd add here as it may be of use to someone, took me a few days to figure out! |
Closing, this should be fixed by the new |
Just adding a remark here, to set the
Where the To generate the
I spend a fair amount of time figuring out that. |
npm config set cafile="C:\mycacert.pem" We use artificatory, so my proxy looks like : this would time me out so i changed them to: hence, going through normal regestry, adding a normal proxy and certificate file. |
This also works: |
We have a secure internet gateway that performs SSL inspection, using the option below to specify the root certificate used by the secure gateway resolved the issue npm config set ca= |
Node.js 7.3.0 added NODE_EXTRA_CA_CERTS environment variable for you to pass the CA certificate file. It is safer than disabling certificate verification using NODE_TLS_REJECT_UNAUTHORIZED.
This solution works with me for node-gyp. |
I'm still seeing this because of a node-gyp dependency and my company uses self-signed certificates. My .npmrc file:
I've also tried various permutations with these, with npm and with yarn: Below magically worked once with
Info:
Below is my stack trace if anyone can help...
I've also tried downloading that package's source code into my company's internal GitLab and configuring my env to look there, but that still fails with the same |
I had the same problem on windows 10. open windows powerShell and enter the following command: Then you can use: npm install [your package] normally. |
I use following on Windows |
I have found a solution as "npm config set registry http://registry.npmjs.org/ " |
nodejs/node#3742 Signed-off-by: Zhi Han <[email protected]>
nodejs/node#3742 Signed-off-by: Zhi Han <[email protected]>
nodejs/node#3742 Signed-off-by: Zhi Han <[email protected]>
Assuming that your SSL CA configuration is done done properly and you configured there the custom CA, you can force node to use the openssl config with the node runtime option |
I faced this issue but for a different reason. Putting it here for future.
|
Nodejs 4 appears to introduce an UNABLE_TO_GET_ISSUER_CERT_LOCALLY error for users behind a company firewall.
Npm install & other commands no longer work after update from Nodejs 0.12 to Nodejs 4 or 5. After discussion on the npm forums, current thought is that this may be an issue in Node rather than Npm.
See npm/npm#9580.
Also
npm/npm#10125
npm/npm#9906
This issue is preventing our team from upgrading to Nodejs 4 or 5. Any suggestions welcome.
Thanks
The text was updated successfully, but these errors were encountered: