前端的一些网络处理方案

302 阅读1分钟

原因

在安装包的时候,遇到了一个github包一直无法安装。所以查找了一些解决方案

terminal挂载代理

#挂载
export all_proxy=http://127.0.0.1:7890

#取消挂载 
unset all_proxy
#查看是否设置完成
echo $all_proxy

git挂代理

# 全局
git config --global https.proxy http://127.0.0.1:1080

git config --global https.proxy https://127.0.0.1:1080

git config --global --unset http.proxy

git config --global --unset https.proxy

#只对github.com
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080

#取消代理
git config --global --unset http.https://github.com.proxy)

# 查看是否配置完成
git config --global  --get https.proxy
git config --global  --get https.proxy

yarn 挂代理

# 挂代理
yarn config set proxy http://127.0.0.1:7890
yarn config set https-proxy http://127.0.0.1:7890
yarn config delete proxy
yarn config delete https-proxy

修改yarn.lock镜像

通过上面的方式全部无法从github上拉去包,最后,我采用通过gitee映射github镜像。

并且修改了yarn.lock仓库地址完成了包的拉取。

image.png

image.png