安装 node.js 后可能出现 npm 安装包时报错
unable to verify the first certificate
的问题,本文记录解决方案。
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npm.taobao.org/vant failed, reason: unable to verify the first certificate
As of February 27, 2014, npm no longer supports its self-signed certificates.
2014年2月27日,npm不再支持自签名证书。因为npm install走的是https协议,需要通过数字证书来保证的。
npm config set strict-ssl false
npm config set strict-ssl true
npm config set registry http://registry.cnpmjs.org/
npm config set registry http://registry.npm.taobao.org/