安装nodejs时出现的报错

这个错误的原因是当前的 yum 源没有包含 Node.js 和 npm 的安装包。
解决方法
使用 NodeSource 仓库
bash
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -
运行 yum install 安装 Node.js 和 npm:
bash
yum install -y nodejs
使用 EPEL 源
安装 EPEL 仓库:
bash
yum install -y epel-release
安装 Node.js 和 npm:
bash
yum install -y nodejs npm
验证安装
bash
node -v
npm -v