How to add local issuer certificate to npm / gyp

  node.js, npm, ssl, windows

I have a web filter installed on my device. The company that provides my web filter installs a custom certificate on my machine to somehow interacts with ssl and enables them to filter my web access (browsing, http requests etc.)

The problem I am getting is that when I try to install a npm package in my node application, I receive an error that the local issuer certificate cannot be retrieved.

Is it possible for me to add the certificate to npm so that it can ‘get’/retrieve it, in order to solve my issue?

Here is the relevant part of my error log:

PS C:UserssomeUserOneDriveDesktopsomeDirectory> npm i bcrypt

> [email protected] install C:UserssomeUserOneDriveDesktopsomeDirectorynode_modulesbcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source 
compile with node-gyp) 
node-pre-gyp WARN Hit error unable to get local issuer certificate
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34)
gyp ERR! stack     at TLSSocket.emit (events.js:315:20)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:936:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12)
gyp ERR! System Windows_NT 10.0.18363

Thank you 🙂

Source: Windows Questions

One Reply to “How to add local issuer certificate to npm / gyp”

LEAVE A COMMENT