CentOS更新Node.js到最新版主要有以下两种方法:
sudo yum remove nodejs。curl -sL https://rpm.nodesource.com/setup_current.x | sudo bash -(安装最新版)或curl -sL https://rpm.nodesource.com/setup_lts.x | sudo bash -(安装LTS版)。sudo yum install -y nodejs。node -v。curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash。source ~/.bashrc。nvm ls-remote。nvm install node(安装最新稳定版)或nvm install <版本号>(安装指定版本)。nvm use <版本号>,设置默认版本:nvm alias default <版本号>。node -v。