软件管理器安装
apt install/pacman install etc.
添加 NodeSource 仓库
# debian系
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# 其它如红帽系
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
添加后update仓库。
手动安装
使用nvm安装
通用跨平台,更友好。
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
# 安装最新版本
nvm install node