To add the repository for the latest version of Node.js 14.x, use the following command as root.
curl -sL https://rpm.nodesource.com/setup_14.x | bash -
To install Node.js 12. x, use the following command as root.
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
To install Node.js 10.x, use the following command as root.
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
Now installing nodejs14 in the system.
Next, you can now install Nodejs and NPM on your system using the command below:
yum -y install nodejs
optional: There are development tools such as GCC-c++ and make that you need to have on your system in order to build native addons from npm
Use below command:
yum install gcc-c++ make -y
NPM and Nodejs has installed.
To check the version of npm and nodejs, use the below command :
node -v npm -v