← 返回全部急救指南
medium
✓ 实测验证日期: 2026-11-26 Node.js 22 LTS / AGY v2.35.2
network agy agygemini-cligemini-api
企业代理证书报错(UNABLE_TO_GET_ISSUER_CERT_LOCALLY)
UNABLE_TO_GET_ISSUER_CERT_LOCALLY ECONNRESET SELF_SIGNED_CERT_IN_CHAIN
常见症状特征
- • Node-based CLI or MCP fails TLS handshake behind Zscaler, Netskope, or corporate MITM proxy.
- • Browser works normally, but `gemini` CLI and `npx agycraft-mcp` fail with certificate chain errors.
故障根因
Node.js 默认使用内置 CA 证书库,会忽略系统企业根证书,必须通过 `NODE_EXTRA_CA_CERTS` 指定可读的 PEM 证书链并核对 `HTTPS_PROXY`。
分步修复步骤
- 1 导出企业根证书并确保为 Base64 PEM 格式(
.crt/.pem)。 - 2 在 Shell 配置中设置
NODE_EXTRA_CA_CERTS指向该证书的绝对路径。 - 3 检查
HTTPS_PROXY/NO_PROXY格式(需包含http://或https://协议头)。 - 4 运行
npx agycraft-mcp doctor验证证书路径可读性。
一键复制修复命令
Configure Node extra CA bundle (macOS/Linux) (unix)
export NODE_EXTRA_CA_CERTS="/path/to/corporate-root-ca.pem" Configure Node extra CA bundle (PowerShell) (windows)
$env:NODE_EXTRA_CA_CERTS="C:\certs\corporate-root-ca.pem" Test TLS with Node native fetch (all)
node -e 'fetch("https://registry.npmjs.org/-/ping").then(r=>console.log("HTTP", r.status))' 修完验证命令
Verify
node -e 'fetch("https://registry.npmjs.org/-/ping").then(r=>console.log("OK", r.status))'