当我们在使用npm install xxx
时,由于使用国外镜像,安转速度特别慢,有时甚至会因为网络超时而报错,这时就需要设置mnpm镜像
- 设置淘宝镜像
npm config set registry http://registry.npm.taobao.org
- 查看镜像是否设置成功
npm get registry
- 设置npm官网镜像
npm config set registry https://registry.npmjs.org
- 使用cnpm代替npm进行安装
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 之后安装使用cnpm代替npm
cnpm install