系统依赖更新

yum update -y

安装git

yum install git -y

安装nvm

git clone https://gitee.com/mirrors/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`

依次运行,配置NVM的环境变量

echo ". ~/.nvm/nvm.sh" >> /etc/profile
source /etc/profile

修改npm镜像源为阿里云镜像

export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node

查看node可用版本,安装node版本lts

nvm list-remote
nvm install 18 --lts