1.临时设置
npm --registry https://registry.npm.taobao.org install express
2.持久设置
npm config set registry https://registry.npm.taobao.org
验证 npm config get registry 或 npm info express
3.cnpm下载
npm install -g cnpm --registry=https://registry.npm.taobao.org
4、升级cnpm淘宝镜像为最新版本
npm install npm@latest -g cnpm --registry=http://registry.npm.taobao.org
5、用npm命令使用淘宝镜像
npm自身就默认代的镜像:http://registry.npmjs.org
npm config set registry http://registry.npmjs.org
如果用npm命令使用淘宝镜像,再次修改为npm的淘宝链接:
npm config set registry http://registry.npm.taobao.org
6、卸载cnpm重新安装
卸载 npm uninstall -g cnpm --registry=https://registry.npm.taobao.org
注册 npm set registry https://registry.npm.taobao.org
解析 npm set disturl https://npm.taobao.org/dist
安装 npm install -g cnpm --registry=https://registry.npm.taobao.org