npm install 卡住?管理镜像源!

        在下载依赖时,普遍都会配置npm代理来提高速度,但是npm install总是会莫名其妙卡住,这一般是代理配置的问题,我们可以使用nrm来管理镜像源来解决这个问题:

1.配置nrm代理:

//  配置nmp代理来提高速度,如设置淘宝镜像
npm config set registry https://registry.npm.taobao.org 

// 查看配置是否成功
npm config get registry 

// 成功后重新npm install安装
npm install

 2.nrm对镜像源进行管理:

// 全局安装nrm (mac需要加上sudo)
npm install -g nrm

// 查看可配置的源列表
nrm ls

// 使用配置列表中的源
nrm use taobao

3.对镜像源的其他操作:

1.添加源

        $ nrm add <registry> <url>

2.删除源

        $ nrm del <registry>

3.测试源的反应速度

        $ nrm test <registry>

4.最后附上一些常用的源:

npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npmmirror.com/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/ 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值