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

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

  • 相关阅读:
    观察者模式
    简单工厂
    一个数组先按值排序,如果它的值有相同,就再按键排序(转)
    Python 一些好玩的函数
    python 一些基础知识
    python3 写CSV文件多一个空行的解决办法
    pandas学习笔记
    pycharm2017.1破解方法
    python的Debug调试
    python中字典的陷阱
  • 原文地址:https://www.cnblogs.com/happypayne/p/7732780.html
Copyright © 2011-2022 走看看