3

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.

Abhishek kumar
  • 668
  • 2
  • 7
  • 15

4 Answers4

3

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"
Adam
  • 121
  • 1
  • 7
1

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

Damo
  • 5,698
  • 3
  • 37
  • 55
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 postinstall script. While you are building your angular project some node module is interfering. You can try some earlier version with it. Make sure you are using the compatible npm and node versions.

Else 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 unreferenced node module in your project.

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

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)

pelotu2
  • 35
  • 5