美文网首页
nrm 安装与配置

nrm 安装与配置

作者: Cherry丶小丸子 | 来源:发表于2021-07-20 09:10 被阅读0次

    nrm(npm registry manager )是 npm 的镜像源管理工具,有时候国外资源太慢,使用这个就可以快速地在 npm 源间切换

    1、安装
    npm install nrm -g
    
    2、使用
    执行命令nrm ls查看可选的源
    nrm ls
    
    *npm ---------- https://registry.npmjs.org/
    yarn --------- https://registry.yarnpkg.com/
    tencent ------ https://mirrors.cloud.tencent.com/npm/
    cnpm --------- https://r.cnpmjs.org/
    taobao ------- https://registry.npmmirror.com/
    npmMirror ---- https://skimdb.npmjs.com/registry/
    
    其中,带 * 的是当前使用的源,上面的输出表明当前源是官方源
    
    3、切换
    如果要切换到taobao源
    nrm use taobao
    
    4、添加
    你可以增加定制的源,特别适用于添加企业内部的私有源,执行命令 nrm add <registry> <url>,其中reigstry为源名,url为源的路径
    
    nrm add registry http://registry.npm.frp.trmap.cn/
    
    5、删除
    删除对应的源
    nrm del taobao
    
    6、测试速度
    通过 nrm test 测试相应源的响应时间
    
    7、其他操作
    1、直接安装 cnpm 
    npm install cnpm -g --registry=https://registry.npm.taobao.org/
    
    2、直接更改源地址
    npm set registry https://registry.npm.taobao.org/
    
    3、查看npm源地址
    npm config list
    
    4、删除源地址
    npm config rm registry
    

    相关文章

      网友评论

          本文标题:nrm 安装与配置

          本文链接:https://www.haomeiwen.com/subject/qqdcmltx.html