1. 程式人生 > >Ubuntu安裝最新版的nodejs

Ubuntu安裝最新版的nodejs

安裝玩Ubuntu的虛擬機器之後安裝nodejs發現npm的版本才3.5.2,這都多老了?於是Google了一下,發現是由於Ubuntu官方維護的包源太老了,想要安裝nodejs的最新版,兩種方法,一種自己去官網下載,另一種修改獲取源

我使用的是後者,參考地址:https://github.com/nodesource/distributions

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs

這樣就修改了源的地址,下面開始安裝nodejs

sudo apt update
sudo apt install nodejs