柚子快报邀请码778899分享:npm太慢, 修改npm镜像

http://yzkb.51969.com/

今天晚上想要将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使用

  cnpm 定制的命令行工具可以代替 npm

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

使用cnpm

npm info underscore

 

cnpm install xxx

eg:

  cnpm install express

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

柚子快报邀请码778899分享:npm太慢, 修改npm镜像

http://yzkb.51969.com/

推荐文章

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。