zoukankan      html  css  js  c++  java
  • 设置npm源的几种方式

    设置npm源的几种方式

    原始源

    # the original source
    https://registry.npmjs.org/
    

    方案: 使用nrm

    • 安装
    npm install -g nrm
    
    • 列出源的候选项
    nrm ls
    

    输出结果:

    * npm -------- https://registry.npmjs.org/
      yarn ------- https://registry.yarnpkg.com/
      cnpm ------- http://r.cnpmjs.org/
      taobao ----- https://registry.npm.taobao.org/
      nj --------- https://registry.nodejitsu.com/
      npmMirror -- https://skimdb.npmjs.com/registry/
      edunpm ----- http://registry.enpmjs.org/
    
    • 使用淘宝源
    nrm use taobao
    

    方案: 改变全局的注册

    • 设置成淘宝源
    npm config set registry https://registry.npm.taobao.org
    
    • 查看结果
    npm config get registry
    

    输出结果:

    https://registry.npm.taobao.org/
    
    • 测试一下
    npm info underscore
    

    方案: 在命令行里指定源

    npm --registry https://registry.npm.taobao.org install [name]
    

    方案: 修改 ~/.npmrc

    registry = https://registry.npm.taobao.org
    

    方案: 使用cnpm

    npm install -g cnpm --registry=https://registry.npm.taobao.org
    cnpm install [name]
    

    参照

    淘宝源链接

  • 相关阅读:
    git
    java网络
    配置本地git服务器(gitblit win7)
    atom 插件安装【转载】
    javaIo
    如何在eclipse中设置断点并调试程序
    如何将工程推到github上
    git操作记录
    编码
    node升级7.0以上版本使用gulp时报错
  • 原文地址:https://www.cnblogs.com/steven-yang/p/12317646.html
Copyright © 2011-2022 走看看