前言

nrm 官方介绍

nrm can help you easy and fast switch between different npm registries, now include: npm, cnpm, taobao, nj(nodejitsu). nrm 可以帮助您轻松快速地在不同的 npm 注册中心之间切换,目前包括:npm、cnpm、taobao、nj(nodejitsu)。

安装

1
2
3
4
5
6
7
8
9
10
11
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash

# download and install Node.js
fnm use --install-if-missing 18

# verifies the right Node.js version is in the environment
node -v # should print `v18.20.2`

# verifies the right NPM version is in the environment
npm -v # should print `10.5.0`

使用

使用 nvm 管理 node 版本 1.列出已经安装的 node 版本

1
nvm ls

列出所有可以安装的 node 版本号

1
nvm ls-remote

安装 node

1
2
3
4
// 安装指定版本的node
nvm install 10
// 安装最新稳定版 node
nvm install stable

切换 node 版本

1
nvm use v18.20.2

查看当前 node 版本

1
nvm current

指定默认的 node 版本

1
nvm alias default v18.20.2