zoukankan      html  css  js  c++  java
  • 使用nrm工具高效地管理npm源

    在使用npm时,官方的源下载npm包会比较慢,国内我们基本使用淘宝的源,如果公司内部搭建了一套npm私有仓库,公司内部的源不可能把npm官方的npm包都同步,所以需要切换npm源。如果使用npm/cnpm config set registry xxx来切换源的话,来回切换设置会比较麻烦。使用nrm就可以对源进行高效的管理。使用方法如下:

    全局安装nrm:

    npm install  nrm -g

    常使用的命令包括:ls,use,add,del

    1)nrm  ls。列出已经配置好的所有的源地址。

    nrm ls
    * npm ---- https://registry.npmjs.org/
      cnpm --- http://r.cnpmjs.org/
      taobao - http://registry.npm.taobao.org/

    2)nrm use。切换到指定源上。

    nrm add new https://new.com

    此时,会提示 :

    Registry has been set to: http://r.cnpmjs.org/

    再次执行nrm ls,会得到:

     npm ---- https://registry.npmjs.org/
    *cnpm --- http://r.cnpmjs.org/
     taobao - http://registry.npm.taobao.org/

    3)add。添加一个新的源。

    nrm add new https://new.com

    此时提示:

    add registry new success

    4)del。删除一个已经存在的源

    nrm del new

    此时提示:

    delete registry new success

    其他操作,可以参考

    nrm --help
    Usage: nrm [options] [command]
    
      Commands:
    
        ls                           list all the registries
        current                      show current registry name
        use <registry>               change registry to registry
        add <registry> <url> [home]  add one custom registry
        del|rm <registry>            delete one custom registry
        home <registry> [browser]    open the homepage of registry with optional browser
        test [registry]              show response time for specific or all registries
        help                         print this help
    
      Options:
    
        -h, --help     output usage information
        -V, --version  output the version number

    希望大家有更好的工具可以分享。

  • 相关阅读:
    迅为iTOP4412开发板支持4G以上文件系统扩展
    迅为瑞芯微itop3399开发板Android8系统wifi移植
    centos 下安装显卡驱动步骤
    smarty函数转载
    jquery.qrcode二维码插件生成彩色二维码
    转 jquery插件241个jquery插件—jquery插件大全
    收集的jquery插件
    主机屋空间
    用过的php函数
    VeryMule网上商城
  • 原文地址:https://www.cnblogs.com/happypayne/p/7732780.html
Copyright © 2011-2022 走看看