更换淘宝源
国内用npm网速很慢,经常安装失败。建议使用cnpm代替npm。命令如下:
npm install -g cnpm --registry=https://registry.npm.taobao.org
查看当前npm数据库
npm config get registry
淘宝的数据源:
npm config set registry https://registry.npm.taobao.org
个人私服库数据源:
npm config set registry http://172.16.0.254:9111/repository/npm-public/
安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
npm, yarn查看源和换源:
npm config get registry // 查看npm当前镜像源
npm config set registry https://registry.npm.taobao.org/ // 设置npm镜像源为淘宝镜像
yarn config get registry // 查看yarn当前镜像源
yarn config set registry https://registry.npm.taobao.org/ // 设置yarn镜像源为淘宝镜像
镜像源地址部分如下:
npm --- https://registry.npmjs.org/
cnpm --- https://r.cnpmjs.org/
taobao --- https://registry.npm.taobao.org/
nj --- https://registry.nodejitsu.com/
rednpm --- https://registry.mirror.cqupt.edu.cn/
npmMirror --- https://skimdb.npmjs.com/registry/
deunpm --- http://registry.enpmjs.org/
windows查看是否安装cnpm
- Win+R
- 输入cmd
- 输入cnpm -v