前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[Node] nvm 安装 node 和 npm

[Node] nvm 安装 node 和 npm

作者头像
绿巨人
发布2021-11-08 10:43:33
3.7K0
发布2021-11-08 10:43:33
举报
文章被收录于专栏:绿巨人专栏绿巨人专栏

Node JS

安装

代码语言:javascript
复制
node_mirror: http://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
  • 安装 node 和 npm

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

代码语言:javascript
复制
# 列出可安装的 node 版本
nvm list available

获取的结果:

代码语言:javascript
复制
|   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
代码语言:javascript
复制
# 安装指定的版本,建议使用最新的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
代码语言:javascript
复制
npm install -g nrm
nrm ls
nrm use taobao
  • 方法: change the registry
代码语言:javascript
复制
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
代码语言:javascript
复制
npm --registry https://registry.npm.taobao.org info underscore install xxx
  • 方法: change ~/.npmrc
代码语言:javascript
复制
registry = https://registry.npm.taobao.org
  • 方法: cnpm
代码语言:javascript
复制
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install [name]

常见问题

  • nvm install 失败 解决方案: 使用国内源
  • nvm use 返回 exit status 1: access denied 解决方案: 以管理员身份运行
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-11-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Node JS
    • 安装
      • 配置国内源 Taobao Register
        • 常见问题
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档