nodejs nvm 安装与使用教程
nvm 下载 (https://www.nvmnode.com/guide/download.html)
查看 nvm 版本
nvm version
查看 nodejs版本
nvm list available
查询已安装版本
nvm list
或
nvm ls
| CURRENT | LTS | OLD STABLE | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
| 26.3.0 | 24.16.0 | 0.12.18 | 0.11.16 |
| 26.2.0 | 24.15.0 | 0.12.17 | 0.11.15 |
| 26.1.0 | 24.14.1 | 0.12.16 | 0.11.14 |
| 26.0.0 | 24.14.0 | 0.12.15 | 0.11.13 |
| 25.9.0 | 24.13.1 | 0.12.14 | 0.11.12 |
| 25.8.2 | 24.13.0 | 0.12.13 | 0.11.11 |
| 25.8.1 | 24.12.0 | 0.12.12 | 0.11.10 |
| 25.8.0 | 24.11.1 | 0.12.11 | 0.11.9 |
| 25.7.0 | 24.11.0 | 0.12.10 | 0.11.8 |
| 25.6.1 | 22.22.3 | 0.12.9 | 0.11.7 |
| 25.6.0 | 22.22.2 | 0.12.8 | 0.11.6 |
| 25.5.0 | 22.22.1 | 0.12.7 | 0.11.5 |
| 25.4.0 | 22.22.0 | 0.12.6 | 0.11.4 |
| 25.3.0 | 22.21.1 | 0.12.5 | 0.11.3 |
| 25.2.1 | 22.21.0 | 0.12.4 | 0.11.2 |
| 25.2.0 | 22.20.0 | 0.12.3 | 0.11.1 |
| 25.1.0 | 22.19.0 | 0.12.2 | 0.11.0 |
| 25.0.0 | 22.18.0 | 0.12.1 | 0.9.12 |
| 24.10.0 | 22.17.1 | 0.12.0 | 0.9.11 |
| 24.9.0 | 22.17.0 | 0.10.48 | 0.9.10 |
安装指定版本
// 18.20.8 指定版本
nvm install 18.20.8
删除指定版本
// 18.20.8 指定版本
nvm uninstall 18.16.0
切换指定版本
// 18.20.8 指定版本
nvm use 18.20.8
切换指定版本
// 18.20.8 指定版本
nvm use 18.20.8
若不希望缓存都在C盘,进行以下配置
获取global地址
npm config get prefix
// 设置global地址
npm config set prefix D:\Cache\nvm\node_global
获取cache地址
npm config get cache
// 设置cache地址
npm config set cache D:\Cache\nvm\node_cache
安装 Yarn
npm install -g yarn
// 安装路径则在 D:\Cache\nvm\node_global 中, 不在C盘
配置环境变量
D:\Cache\nvm\node_global\node_modules\yarn\bin
此时 yarn 还是不能使用
获取global地址
yarn config get global-folder
// 设置global地址
yarn config set global-folder D:\Cache\nvm\yarn_global
获取cache地址
yarn config get cache-folder
// 设置cache地址
yarn config set cache-folder D:\Cache\nvm\yarn-cache

浙公网安备 33010602011771号