curl: (7) Failed to connect to 127.0.0.1 port 1087 after 6 ms: Couldn't connect to server

1 通过下面命令查询代理项

env | grep -i proxy 

输出下面内容,也就是代理的错误来源

RUSTUP_DIST_SERVER=https://rsproxy.cn
RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup
http_proxy=http://127.0.0.1:1087
https_proxy=http://127.0.0.1:1087
HOMEBREW_NO_PROXY=1

2 使用下面命令取消代码

  unset http_proxy

3 再用之前的命令检查一下

env | grep -i proxy 

RUSTUP_DIST_SERVER=https://rsproxy.cn
RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup
HOMEBREW_NO_PROXY=1

4 最后检查一下~/.bash_profile,~/.zshrc,~/.bashrc等环境变量配置文件是否有全局代理设置,如果有就注释掉。

posted @ 2025-08-11 02:42  Questions张  阅读(59)  评论(0)    收藏  举报