Auto-sync: 2026-04-17 08:37

This commit is contained in:
2026-04-17 08:38:12 +08:00
parent 6caa1c2f47
commit a0a48bd334
247 changed files with 6577 additions and 3061 deletions

33
wiki/concepts/nvm.md Normal file
View File

@@ -0,0 +1,33 @@
---
title: "nvm"
type: concept
tags: [node-js, version-manager]
last_updated: 2026-04-17
---
## 定义
nvmNode Version Manager是 Node.js 版本管理工具,允许在同一系统上安装和切换多个 Node.js 版本。
## 用途
- 安装指定版本的 Node.js
- 快速切换不同 Node 版本
- 避免全局 npm 包的版本冲突
- 使用非 root 用户安全安装 Node
## 安装方法
```bash
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
```
## 常用命令
```bash
nvm install 20 # 安装 Node 20
nvm use 20 # 切换到 Node 20
nvm alias default 20 # 设置默认版本
nvm list # 列出已安装版本
```
## 关联
- 基于:[[Shell]]
- 管理对象:[[Node-js]]
- 配合工具:[[npm]]、[[npx]]