Problem scenario
You enter the command "npm -v" but get an error about the command not being found or recognized. How do you install npm on a RedHat derivative Linux server?
Solution
(You may want to see these directions instead if you want to use a script that will work on any distribution of Linux (including RHEL, Debian or SUSE distributions). These other directions may also be of interest to you.)
Run these two commands:
sudo su -
yum -y install npm nodejs epel-release