在 Ubuntu 系統中,您可以使用以下步驟來更新 Node.js:
首先,打開終端(快捷鍵:Ctrl + Alt + T)。
檢查當前安裝的 Node.js 版本。在終端中輸入以下命令:
node -v
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
如果您需要特定版本的 Node.js(例如 14.x),請將 setup_lts.x
替換為 setup_14.x
。
sudo apt-get update
sudo apt-get install -y nodejs
node -v
現在,您的 Ubuntu 系統應該已經安裝了最新版本的 Node.js。如果您需要更新到其他版本,只需重復上述步驟并替換相應的版本號。