1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# 安装 nvm(如果尚未安装)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# 重新加载 shell 配置
source ~/.bashrc
# 安装兼容的 Node.js 版本(建议使用 LTS 版本)
nvm install 20.19.0 # 或 nvm install 20(最新 20.x 版本)
# 切换到新安装的版本
nvm use 20.19.0
# 验证版本
node --version
|