Ubuntu 17.10下,系统自带的Node.js比较老了,网上提供的安装新版本的方法都比较麻烦,有些甚至是自己下载源码来编译。其实官方有提供各个系统下的安装脚本,直接运行就能安装最新或者指定版本的Node.js了。注意脚本是两行哦。 1
2
3
4
5
6
7# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_9.x | bash -
apt-get install -y nodejs