在 CentOS 上更新 Node.js 的步骤如下:
sudo yum remove nodejs
sudo yum clean all
curl -sL https://rpm.nodesource.com/setup_lts.x | sudo bash -
如果你想安装特定版本的 Node.js,例如 14.x,可以使用以下命令:
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
sudo yum install nodejs
node -v
npm -v
现在,你已经成功地在 CentOS 上更新了 Node.js。如果你想安装其他版本的 Node.js,只需重复上述步骤并更改版本号即可。