如何在 1 分钟内在 Ubuntu 上安装 NodeJS 20.x LTS
在你的 Ubuntu 计算机上运行这些 shell 命令来安装 NodeJS 20.x:
install_nodejs_20_ubuntu.sh
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y除了 20,你还可以选择其他版本如 18。但是,使用此方法,你无法并行安装多个版本的 NodeJS。
来源: 官方 nodesource 文档
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow