Last Updated: February 25, 2016
·
31.27K
· steve-jansen

Fix npm SELF_SIGNED_CERT_IN_CHAIN or CERT_UNTRUSTED errors

UPDATE

The npm maintainers have rolled back the changes to the npm self-signed certificate. See More help with SELFSIGNEDCERTINCHAIN and npm. I'm leaving this ProTip available in the event npm publishes this certificate change again.

Background

The npm maintainers announced on February 27th that npm’s Self-Signed Certificate is No More:

A bunch of users received a “SELFSIGNEDCERTINCHAIN” error during installing and publishing packages throughout the day today.
The cause: npm no longer supports its self-signed certificates.

However, the recommended fix failed for me.

Workaround

A workaround for the fix is to use the npm environmental variable for the strict-ssl setting:

Linux / OS X:

export npm_config_strict-ssl=false
npm install npm -g --ca=null
npm --version
unset npm_config_strict-ssl

Windows:

SETLOCAL
SET npm_config_strict-ssl=false
npm install npm -g --ca=null
npm --version
ENDLOCAL

1 Response
Add your response

The command you given ,none of them working.
{ [Error: s
IN_CHAIN' }

over 1 year ago ·