首页
Javascript
Html
Css
Node.js
Electron
移动开发
工具类
服务端
浏览器相关
前端收藏
其他

利用nrm快速切换npm源代理

2017年05月22日 发布 阅读(417) 作者:懒炖

nrm是一个npm源管理工具,利用它我们可以快速切换npm源,利用nrm还可以测试哪个源最快。如果哪个npm依赖安装失败,不防切换一下npm源试试

安装

  1. npm install nrm -g

命令

输入nrm,enter后可调出help或nrm help

  1. D:\project>nrm
  2. Usage: cli [options] [command]
  3. Options:
  4. -V, --version output the version number
  5. -h, --help output usage information
  6. Commands:
  7. ls List all the registries
  8. current Show current registry name
  9. use <registry> Change registry to registry
  10. add <registry> <url> [home] Add one custom registry
  11. del <registry> Delete one custom registry
  12. home <registry> [browser] Open the homepage of registry with optional browser
  13. test [registry] Show response time for specific or all registries
  14. help Print this help
nrm ls列出源列表,前面带*号的表示当前在使用
  1. D:\project>nrm ls
  2. npm ---- https://registry.npmjs.org/
  3. * cnpm --- http://r.cnpmjs.org/
  4. taobao - https://registry.npm.taobao.org/
  5. nj ----- https://registry.nodejitsu.com/
  6. rednpm - http://registry.mirror.cqupt.edu.cn/
  7. npmMirror https://skimdb.npmjs.com/registry/
  8. edunpm - http://registry.enpmjs.org/
nrm current 显示当前使用源
  1. D:\project>nrm current
  2. cnpm
nrm use 切换源,如下,切换到npm官方源
  1. D:\project>nrm use npm
  2. Registry has been set to: https://registry.npmjs.org/
  3. D:\project>nrm ls
  4. * npm ---- https://registry.npmjs.org/
  5. cnpm --- http://r.cnpmjs.org/
  6. taobao - https://registry.npm.taobao.org/
  7. nj ----- https://registry.nodejitsu.com/
  8. rednpm - http://registry.mirror.cqupt.edu.cn/
  9. npmMirror https://skimdb.npmjs.com/registry/
  10. edunpm - http://registry.enpmjs.org/

其他命令自己去试吧

版权声明:本站文章除特别声明外,均采用署名-非商业性使用-禁止演绎 4.0 国际 许可协议,如需转载,请注明出处

评论

  •