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使用

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

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

使用cnpm

npm info underscore

 

cnpm install xxx

eg:

  cnpm install express

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM