不要摸索升级当前版本什么的,直接按照以下步骤完成
1.进入官网 https://nodejs.org/en/,下载最新版本
2.解压此类文件,还需要安装一个工具 sudo apt-get install xz-utils
接下来 执行
tar -C /usr/local --strip-components 1 -xJf node-v???-linux.x64.tar.xz
3.最后基本步:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
执行后,
$ node -v
v12.13.1,版本即为更新!