无法安装newman,报SELF_SIGNED_CERT_IN_CHAIN错误如何解决?
解决npm安装newman时SELF_SIGNED_CERT_IN_CHAIN错误的方案
这个错误是由于npm请求官方registry时,证书链中存在自签名证书导致的,大多出现在公司内网代理或本地安全软件拦截的场景下,以下是几种可行的解决方法:
方法1:临时禁用SSL证书校验(临时场景适用)
直接在安装命令中跳过SSL校验:
npm install -g newman --strict-ssl=false
或者先全局配置禁用,再执行安装:
npm config set strict-ssl false npm install -g newman
安装完成后,建议恢复SSL校验以保证后续包安装的安全性:
npm config set strict-ssl true
方法2:更换npm镜像源
使用国内镜像源绕过证书问题:
npm config set registry https://registry.npmmirror.com npm install -g newman
方法3:导入自签名证书(长期解决方案,适合内网环境)
如果处于公司内网环境,可将内网的自签名证书导入npm信任列表:
npm config set cafile "C:\路径\到\你的\证书文件.crt" npm install -g newman
内容的提问来源于stack exchange,提问作者Abdul Rahuman
相关产品推荐
相关产品推荐

