fetch failed 错误
问题
为什么请求总是显示 fetch failed?
答案
可能是因为所在地区的网络环境导致的,可以尝试使用代理工具。目前暂时无备用 API 端点。
解决方案
配置代理
bash
# 临时设置代理
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
# 测试连接
claude-cli "测试"
常用代理工具
Clash
bash
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
V2Ray
bash
export HTTP_PROXY=http://127.0.0.1:10809
export HTTPS_PROXY=http://127.0.0.1:10809
永久配置
bash
# 添加到Shell配置文件
echo 'export HTTP_PROXY=http://127.0.0.1:7890' >> ~/.bashrc
echo 'export HTTPS_PROXY=http://127.0.0.1:7890' >> ~/.bashrc
source ~/.bashrc