ionic2起步-各种代理配置

2016-12-29  本文已影响0人  chenhongbinjs

至于为什么要使用代理,怎么申请代理,这里就不说了。

一、解决git速度慢

1、git配置代理

git config --global http.proxy http://127.0.0.1:6152

git config --global https.proxy http://127.0.0.1:6152

2、git取消代理

git config --global --unset http.proxy

git config --global --unset https.proxy

3、加快git解析速度(配置host)

通过修改hosts文件

sudo vim /etc/hosts

加入

151.101.44.249 github.global.ssl.fastly.Net

这里的ip就是从http://github.global.ssl.fastly.net.ipaddress.com/#ipinfo获取最快的ip

二、解决npm被墙(参考npm翻墙nrm镜像切换

1、npm代理设置

npm config set proxy=http://127.0.0.1:6152

npm config set https_proxy=http://127.0.0.1:6152

2、npm取消代理

npm config delete proxy

npm config delete https_proxy

3、也可以通过切换国内镜像解决

手工切换国内镜像

npm config set registry=http://r.cnpmjs.org

注意:使用国内镜像的时候就不要使用代理了

4、使用nrm快速切换镜像

npm install -g nrm

如何切换:

nrm use cnpm

测试镜像速度

nrm test cnpm

上一篇 下一篇

猜你喜欢

热点阅读