Using a RHEL server in AWS, you try this command "npm -v", and it shows that npm is not installed. You want to use the npm utility or you want Node.js to be installed on your RedHat version 7 Linux server in AWS. You may have tried various yum commands but received errors about dependencies. Various other scripts fail to get npm to be a recognized command. How do you install npm and/or Node.js without changing yum repositories and without using the wget command?
Warning: This solution takes approximately 30 minutes, but it does not require interaction. Do not try this solution on a sever with less than 1 GB of RAM. If you want extra swap space, you can see this posting. If you want to install npm on a different distribution of Linux, see this posting.
1. Create a file named "npminstaller.sh" (with no quotes) with the following content:
#If version changes to 9, update the cd node-v8* command below
curl http://nodejs.org/dist/v$version/node-v$version.tar.gz > node-v$version.tar.gz
tar xzvf node-v$version.tar.gz
yum -y install gcc gcc-c++
2. Run the script with
sudo bash npminstaller.sh with no quotes.