vim ~/.npmrc
registry = https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org
npm config get registry # 如果返回https://registry.npm.taobao.org,说明配置成功
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install xxx
npm config set registry https://registry.npmjs.org/