您当前的位置: 首页 >  node.js

彭世瑜

暂无认证

  • 2浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Node.js:使用nrm来管理npm源

彭世瑜 发布时间:2022-08-22 10:13:18 ,浏览量:2

文档

  • github https://github.com/Pana/nrm
  • npmjs https://www.npmjs.com/package/nrm
npm切换源
# 设置源
$ npm set registry https://registry.npm.taobao.org/

# 查看npm源
$ npm config ls
使用nrm管理npm源

安装

$ npm install -g nrm

查看帮助

$ nrm -h
Usage: nrm [options] [command]

Options:
  -V, --version                           output the version number
  -h, --help                              output usage information

Commands:
  ls                                      List all the registries
  current [options]                       Show current registry name or URL
  use                           Change registry to registry
  add   [home]             Add one custom registry
  login [options]  [value]  Set authorize information for a custom registry with a base64 encoded string or username and pasword
  set-hosted-repo        Set hosted npm repository for a custom registry to publish packages
  set-scope             Associating a scope with a registry
  del-scope                    Remove a scope
  set [options]             Set custom registry attribute
  rename           Set custom registry name
  del                           Delete one custom registry
  home  [browser]               Open the homepage of registry with optional browser
  publish [options] [|]  Publish package to current registry if current registry is a custom registry.
   if you're not using custom registry, this command will run npm publish directly
  test [registry]                         Show response time for specific or all registries
  help                                    Print this help 
   if you want to clear the NRM configuration when uninstall you can execute "npm uninstall nrm -g -C or npm uninstall nrm -g --clean"

使用

# 查看源列表
$ 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/


# 使用源
$ nrm use cnpm
Registry has been set to: https://r.cnpmjs.org/

参考 nrm详解

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.0724s