curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Alternatively, for Node.js v7:
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
方法来自官方文档:https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions