Solution 1:

sudo yum install nodejs npm --enablerepo=epel

Solution 2:

To install NodeJS 6.x execute the following commands:

curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource

Update

You can install NodeJS 7 and 8 in the same way. Just specify the version you need instead of 6 in the command above.

Update

To update to NodeJS 16 (or any other version) do the following:

rm -rf /etc/yum.repos.d/nodesource-el*
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
yum install nodejs --enablerepo=nodesource