nrm&nvm


nrm安装

nrm

nrm(npm registry manager)是npm的镜像管理工具,有时候国外的资源太慢,使用这个就可以快速地在npm源间切换。

安装nrm

在命令行执行命令,npm install -g nrm,全局安装nrm。
使用
一般来说,在终端直接运行基础命令,可以看到该命令的解析,使用方法。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Usage: cli [options] [command]

Options:
-V, --version output the version number
-h, --help display help for command

Commands:
ls List all the registries
current [options] Show current registry name or URL
use <name> Change current registry
add <name> <url> [home] Add custom registry
login [options] <name> [base64] Set authorize information for a custom registry with
a base64 encoded string or username and password
set-hosted-repo <name> <repo> Set hosted npm repository for a custom registry to
publish package
set-scope <scopeName> <url> Associating a scope with a registry
del-scope <scopeName> Remove a scope
set [options] <name> Set a custom registry attribute
rename <name> <newName> Change custom registry name
del <name> Delete custom registry
home <name> [browser] Open the homepage of registry with optional browser
test [registry] Show response time for specific or all registries
help [command] display help for command

nvm安装

去github 下载最新的 nvm 找到 nvm-setup.zip 点击下载

配置路径和下载源

安装完nvm后先不要着急安装node。

找到nvm安装路径 -> 找到 settings.txt 文件 -> 配置下载源

1
2
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

使用nvm安装node

在终端输入 nvm list available, 查看网络可以安装的版本。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
| 22.4.1 | 20.15.1 | 0.12.18 | 0.11.16 |
| 22.4.0 | 20.15.0 | 0.12.17 | 0.11.15 |
| 22.3.0 | 20.14.0 | 0.12.16 | 0.11.14 |
| 22.2.0 | 20.13.1 | 0.12.15 | 0.11.13 |
| 22.1.0 | 20.13.0 | 0.12.14 | 0.11.12 |
| 22.0.0 | 20.12.2 | 0.12.13 | 0.11.11 |
| 21.7.3 | 20.12.1 | 0.12.12 | 0.11.10 |
| 21.7.2 | 20.12.0 | 0.12.11 | 0.11.9 |
| 21.7.1 | 20.11.1 | 0.12.10 | 0.11.8 |
| 21.7.0 | 20.11.0 | 0.12.9 | 0.11.7 |
| 21.6.2 | 20.10.0 | 0.12.8 | 0.11.6 |
| 21.6.1 | 20.9.0 | 0.12.7 | 0.11.5 |
| 21.6.0 | 18.20.4 | 0.12.6 | 0.11.4 |
| 21.5.0 | 18.20.3 | 0.12.5 | 0.11.3 |
| 21.4.0 | 18.20.2 | 0.12.4 | 0.11.2 |
| 21.3.0 | 18.20.1 | 0.12.3 | 0.11.1 |
| 21.2.0 | 18.20.0 | 0.12.2 | 0.11.0 |
| 21.1.0 | 18.19.1 | 0.12.1 | 0.9.12 |
| 21.0.0 | 18.19.0 | 0.12.0 | 0.9.11 |
| 20.8.1 | 18.18.2 | 0.10.48 | 0.9.10 |

This is a partial list. For a complete list, visit https://nodejs.org/en/download/releases

nvm install

nvm use

node -vnpm -v可以查询到node和npm的版本号

输入nvm list 查看已经安装的node,*号表示当前使用的node版本

nvm常用命令

命令 说明
nvm list 查看已经安装的版本
nvm list installed 查看已经安装的版本
nvm list available 查看网络可以安装的版本
nvm arch 查看当前系统的位数和当前nodejs的位数
nvm install [arch] 安装制定版本的node 并且可以指定平台 version 版本号 arch 平台
nvm on 打开nodejs版本控制
nvm off 关闭nodejs版本控制
nvm proxy [url] 查看和设置代理
nvm node_mirror [url] 设置或者查看setting.txt中的node_mirror,如果不设置的默认是 https://nodejs.org/dist/
nvm npm_mirror [url] 设置或者查看setting.txt中的npm_mirror,如果不设置的话默认的是:https://github.com/npm/npm/archive/.
nvm uninstall 卸载指定的版本
nvm use [version] [arch] 切换指定的node版本和位数
nvm root [path] 设置和查看root路径
nvm version 查看当前的版本


文章作者: ZTGD
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 ZTGD !
评论
  目录