CentOS上更新Node.js主要有两种方法:
sudo yum remove nodejs。sudo yum install -y curl gcc-c++ make。curl -sL https://rpm.nodesource.com/setup_lts.x | sudo bash -(lts.x可替换为具体版本号,如14.x)。sudo yum install -y nodejs。node -v。sudo yum remove nodejs。curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash。source ~/.bash_profile(或source ~/.bashrc等)。nvm install --lts(或nvm install <具体版本号>)。nvm use <版本号>。node -v。