设置淘宝镜像

1,803 阅读1分钟

设置 npm 源为淘宝镜像

修改为淘宝镜像

npm config set registry http://registry.npm.taobao.org/

还原

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

设置cnpm为淘宝镜像,npm为原镜像

步骤:

1、修改源

npm config set registry http://registry.npm.taobao.org/

2、修改为淘宝镜像后,npm的源就是淘宝源,可通过 以下命令查看源

npm config get registry 

3、全局安装cnpm,此时的cnpm指向的是淘宝镜像 r.npm.taobao.org/,npm也是指向淘宝镜… r.npm.taobao.org/

npm install cnpm -g

4、再还原npm的源,此时的npm指向的源是registry.npmjs.org/,而cnpm指向的源是…

npm config set registry https://registry.npmjs.org/
备注:全局安装了cnpm之后还需要配置环境变量才能使用cnpm命令