nrm切换npm源 - lzr_must的博客 - CSDN博客

npm源就是下载需要依赖包的服务器地址,默认是 npm ---- https://registry.npmjs.org/

国内的小伙伴会发现,国外的源速度太慢,于是就会找到国内的淘宝源taobao - https://registry.npm.taobao.org/

可以通过nano ~/.npmrc 来修改npm的源,但是手动修改太耗费体力。于是就有了工具nrm,它可以通过命令行管理源。

全局安装 nrm

npm  install   -g   nrm

查看nrm命令

nrm -h

➜  ~ nrm -h
  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 <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

我电脑上的源,如下:

**  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/      目前npm 正在使用的源地址
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
  sinopia  http://100.XX.XX.XX:XXXX/     sinopia 为公司自己搭建的npm仓库
**

nrm最常有的命令有 :

1.nrm ls 查看已有的源 

2.nrm add <源名称> <源地址> 新增源

3.nrm use <源名称>切换到现有的源

4.nrm test  测速


原网址: 访问
创建于: 2018-10-13 19:14:52
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论