方法一: 由npm切换cnpm镜像地址
1.切换淘宝源
npm config set registry https://registry.npm.taobao.org --global
2.验证配置
npm config get registry
3.使用cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
方法二: 由cnpm切换npm镜像地址
1.切换到淘宝cnpm
npm config set registry https://registry.npm.taobao.org
2.检查配置
npm config get registry
3.还原npm
npm config set registry https://registry.npmjs.org