npm太慢, 修改npm镜像

今天晚上想要将clone下来的项目进行npm install,但是等了半天都没动

查看源

npm config get registry

npm config list

https://registry.npmjs.org/国外的节点

每次用npm的,因为走国外的镜像,非常的慢

通过改变默认npm镜像代理服务,可以大幅提升安装速度

方法:

1.命令行指定(临时)

npm --registry https://registry.npm.taobao.org info underscore 

说明:

  这种方式是在使用命令时,添加 --registry https://registry.npm.taobao.org 

  如:

    npm install  express --registry=https://registry.npm.taobao.org

    安装express,使用淘宝源

2.通过config命令(长久)

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

查看

npm info underscore

3.通过cnpm使用

npm install -g cnpm --registry=https://registry.npm.taobao.org

使用cnpm

npm info underscore

 

cnpm install xxx

eg:

  cnpm install express

 修改了镜像源,安装就非常快了

猜你喜欢

转载自www.cnblogs.com/baby123/p/10753728.html