Yarn

1
2
3
4
5
6
7
8
9
10
yarn config get registry

> https://registry.yarnpkg.com


yarn config set registry 'https://registry.npm.taobao.org'

> yarn config v0.15.0
> success Set "registry" to "https://registry.npm.taobao.org".
> Done in 0.04s.

NPM

1
2
3
4
5
6
7
8
9
10
11
12
13
 npm install -g cnpm --registry=https://registry.npm.taobao.org

# Or
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"

# Or alias it in .bashrc or .zshrc
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc

Ruby

Ruby-China

1
2
3
gem source -a https://gems.ruby-china.org
# Or make it only has 1 source
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/