最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error: unable to get local issuer certificate - Stack Overflow

programmeradmin3浏览0评论

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.

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.

Share Improve this question asked Jun 24, 2021 at 7:38 Abhishek kumarAbhishek kumar 7482 gold badges7 silver badges15 bronze badges 6
  • try running npm config set strict-ssl false – michal.jakubeczy Commented Jun 24, 2021 at 8:22
  • 2 Yeah I already tried this command...But still nothing – Abhishek kumar Commented Jun 24, 2021 at 8:44
  • 2 and what about running set NODE_TLS_REJECT_UNAUTHORIZED=0 if you're on Win run npm config set NODE_TLS_REJECT_UNAUTHORIZED=0 – michal.jakubeczy Commented Jun 24, 2021 at 8:59
  • even I also tried this but still no luck – Abhishek kumar Commented Jun 24, 2021 at 9:38
  • 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. – Abhishek kumar Commented Jul 25, 2021 at 6:25
 |  Show 1 more comment

8 Answers 8

Reset to default 10

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"

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

set NODE_TLS_REJECT_UNAUTHORIZED=0

this is working for me :)

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)

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.

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.

In my case I discovered that I had a VPN blocking the request. If you have a VPN or other proxy, try turning it of when you install that package. It was able to verify the certificate after I turned mine off.

@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.

发布评论

评论列表(0)

  1. 暂无评论