Error: unable to get local issuer certificate
Asked Answered
N

7

6

I am running the angular app in my local machine in the VS code when I fire the command npm install in my VS code terminal I am getting below error

gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
gyp ERR! stack     at TLSSocket.emit (events.js:315:20)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:932:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
gyp ERR! System Windows_NT 10.0.18363

Can anyone let me know how to rectify this error as I have already wasted my 3 days to overcome this error but still could not find.

Nonesuch answered 24/6, 2021 at 7:38 Comment(6)
try running npm config set strict-ssl falseLappet
Yeah I already tried this command...But still nothingNonesuch
and what about running set NODE_TLS_REJECT_UNAUTHORIZED=0 if you're on Win run npm config set NODE_TLS_REJECT_UNAUTHORIZED=0Lappet
even I also tried this but still no luckNonesuch
Actually there is problem with my laptop configuration as when I connected with phone hotspot it works fine for me but not when I connected with the wi-fi.Nonesuch
Does this answer your question? gyp ERR, Npm is unable to get local issuer certificatePaulettapaulette
M
9

I saw the same error (also on Win10) and the other suggestions didn't work for me. The NODE_TLS_REJECT_UNAUTHORIZED setting in npm config didn't have an effect, but setting it as an environment variable did work:

$env:NODE_TLS_REJECT_UNAUTHORIZED="0"
Misdate answered 27/7, 2022 at 10:48 Comment(3)
it works correct with nodejs version v18.18.0Cobb
On windows with Node v18.7.1 I run set NODE_TLS_REJECT_UNAUTHORIZED=0 without quotes, as suggested in a previous comment by @Lappet and it workedAmmonal
how you set it as an environment variable?Tocsin
R
2

This seems like a very similar problem to this gyp ERR, Npm is unable to get local issuer certificate

You can either ignore the error much like:

npm config set strict-ssl false

Or to set the environment variable NODE_EXTRA_CA_CERTS as described here gyp ERR, Npm is unable to get local issuer certificate

Rabush answered 13/8, 2021 at 13:36 Comment(0)
Y
0

npm config set strict-ssl false -- THIS FAILED FOR ME

But, for your angular issue - this is a compatibility problem - just check the log and where it fails for the post-install script. While you are building your angular project some node module is interfering. You can try some earlier versions with it. Make sure you are using the compatible npm and node versions.

Otherwise you may have to uninstall and install node and then Angular cli - Try building it again.

If you have already tried it, then go to the logs and remove the unreferenced node module in your project.

I faced the same problem while I was working with electronJS today and it gave the same issue.

Yclept answered 24/6, 2021 at 17:18 Comment(0)
K
0

Maybe you have installed in your pc a version of node newer and incompatible with the one of the angular app. Try using Node Virtual Machine (nvm) to have multiple versions of node installed and therefore multiple versions of angular (globally)

Kiosk answered 19/12, 2022 at 8:58 Comment(0)
A
0

You can manually download the package zip and then, in the package.json, reference the file in place of the version number, like this:

"azure-functions-core-tools": "file:..\Azure.Functions.Cli.win-x64.4.0.5907.zip"

Worked for me.

Actual answered 29/8 at 13:36 Comment(0)
B
-1

@abhishek-kumar commented my solution.

I tried all the suggestions, then connected to my phone hotspot.

Was using company internet which blocks access to ETHERSCAN. Connecting to network that allows access solved my problem.

Babita answered 9/5 at 8:49 Comment(2)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewCurl
Okay, but it will help people with similar problem to identify the solution. It helped me so I confirm the solution.Babita
C
-1

set NODE_TLS_REJECT_UNAUTHORIZED=0

this is working for me :)

Chillon answered 18/6 at 3:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.