• [Node] nvm 安装 node 和 npm


    Node JS

    安装

    node_mirror: http://npm.taobao.org/mirrors/node/
    npm_mirror: https://npm.taobao.org/mirrors/npm/
    
    • 安装 node 和 npm

    可以使用 command 或者 git-bash 运行。(注意: nvm use 命令必须要以管理员身份运行)

    # 列出可安装的 node 版本
    nvm list available
    

    获取的结果:

    |   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
    |--------------|--------------|--------------|--------------|
    |    17.0.1    |   16.13.0    |   0.12.18    |   0.11.16    |
    |    17.0.0    |   14.18.1    |   0.12.17    |   0.11.15    |
    |   16.12.0    |   14.18.0    |   0.12.16    |   0.11.14    |
    |   16.11.1    |   14.17.6    |   0.12.15    |   0.11.13    |
    |   16.11.0    |   14.17.5    |   0.12.14    |   0.11.12    |
    |   16.10.0    |   14.17.4    |   0.12.13    |   0.11.11    |
    |    16.9.1    |   14.17.3    |   0.12.12    |   0.11.10    |
    |    16.9.0    |   14.17.2    |   0.12.11    |    0.11.9    |
    |    16.8.0    |   14.17.1    |   0.12.10    |    0.11.8    |
    |    16.7.0    |   14.17.0    |    0.12.9    |    0.11.7    |
    |    16.6.2    |   14.16.1    |    0.12.8    |    0.11.6    |
    |    16.6.1    |   14.16.0    |    0.12.7    |    0.11.5    |
    |    16.6.0    |   14.15.5    |    0.12.6    |    0.11.4    |
    |    16.5.0    |   14.15.4    |    0.12.5    |    0.11.3    |
    |    16.4.2    |   14.15.3    |    0.12.4    |    0.11.2    |
    |    16.4.1    |   14.15.2    |    0.12.3    |    0.11.1    |
    |    16.4.0    |   14.15.1    |    0.12.2    |    0.11.0    |
    |    16.3.0    |   14.15.0    |    0.12.1    |    0.9.12    |
    |    16.2.0    |   12.22.7    |    0.12.0    |    0.9.11    |
    |    16.1.0    |   12.22.6    |   0.10.48    |    0.9.10    |
    
    This is a partial list. For a complete list, visit https://nodejs.org/download/releases
    
    # 安装指定的版本,建议使用最新的LTS(长期服务)版本。
    nvm install 16.13.0
    
    # 列出安装的版本
    nvm list
    # $  * 16.13.0 (Currently using 64-bit executable)
    
    # 使用指定的版本(注意: nvm use 命令必须要以管理员身份运行)
    nvm use 16.13.0
    # $ Now using node v16.13.0 (64-bit)
    

    配置国内源 Taobao Register

    • 方法: nrm
    
    npm install -g nrm
    nrm ls
    nrm use taobao
    
    • 方法: change the registry
    npm config get registry
    npm config set registry https://registry.npm.taobao.org
    # Test it
    npm info underscore
    # the original source
    # npm config set registry https://registry.npmjs.org/
    
    • 方法: specific the repository in command line
    npm --registry https://registry.npm.taobao.org info underscore install xxx
    
    • 方法: change ~/.npmrc
    registry = https://registry.npm.taobao.org
    
    • 方法: cnpm
    npm install -g cnpm --registry=https://registry.npm.taobao.org
    cnpm install [name]
    
    

    常见问题

    • nvm install 失败
      解决方案: 使用国内源

    • nvm use 返回 exit status 1: access denied
      解决方案: 以管理员身份运行

    非常感谢阅读!如有不足之处,请留下您的评价和问题。
    请“推荐”本文!
  • 相关阅读:
    软件对标分析
    第一阶段绩效评估
    自律小帮手:Alpha版使用说明
    团队 电梯演讲 原型展示
    意见评论
    Alpha版(内部测试版)发布
    意见汇总
    产品对比
    团队项目-第二阶段冲刺-3
    团队项目-第二阶段冲刺-2
  • 原文地址:https://www.cnblogs.com/steven-yang/p/15502627.html
Copyright © 2020-2023  润新知