As a developer you might need to install packages that are hosted on artifact repositories that your VPN / fireware does not allow to access. E.g.
Downloading Chromium 116.0.5845.82 (playwright build v1076) from https://playwright-akamai.azureedge.net/builds/chromium/1076/chromium-mac-arm64.zip
Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34)
at TLSSocket.emit (node:events:513:28)
at TLSSocket._finishInit (node:_tls_wrap:953:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12) {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
In such case, you can set Custom CA while downloading.
Install OpenSSL:
brew cleanup && brew update
brew install openssl -f
Generate the private key to become a local CA:
openssl genrsa -des3 -out myCA.key 2048
mkdir certs
cd certs
Generate a root certificate:
openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem
You should now have two files:
myCA.key (your private key) and myCA.pem (your root certificate).
Ref: https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
Now you can set CA while installing from remote:
NODE_EXTRA_CA_CERTS="{path}/certs/myCA.pem" npx <forbidden_pacakge> install
Top comments (0)