# 安装源
curl -O https://deb.nodesource.com/setup_12.x
chmod +x setup_12.x
./setup_12.x
# 安装nodejs
sudo apt-get -y install nodejs
# 验证
nodejs --version
其他方法
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
```