天天看點

【Linux】Ubuntu下如何安裝指定版本nodejs和npm

對于nodejs和npm的安裝,如果是通過apt-get 指令進行直接安裝的話 版本相對較低.

然而當你需要安裝特定版本時該怎麼辦呢?

其實nodejs的官方給出了安裝方式,

在官方連結,https://github.com/nodesource/distributions 中給出了解決方案,

部分内容如下,

Node.js Current (v16.x):

# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs
           

繼續閱讀