一、安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

二、更换npm源

npm config set registry https://registry.npm.taobao.org
// 配置后可通过下面方式来验证是否成功
npm config get registry

三、还原npm源

npm config set registry https://registry.npmjs.org/

四、github国内加速

// 克隆加速
git clone https://github.com/princeljf/DMK.git
// 改为
git clone https://github.com.cnpmjs.org/princeljf/DMK.git