要在 Ubuntu 上将 Node.js 更新到最新版本,你可以使用 NodeSource 存储库。以下是详细步骤:
sudo apt-get remove --purge nodejs
sudo apt-get autoremove
sudo apt-get update
sudo apt-get install curl software-properties-common
16.x
为你想要的版本号。curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
npm --version
现在,你已经成功地将 Node.js 更新到了最新版本。如果你想在未来继续更新 Node.js,只需重复上述步骤并更改存储库中的版本号即可。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: Ubuntu中Apache2如何设置虚拟主机