Background
I’m working on setting up a development environment on AWS EC2 with Node.js and MongoDB. After following a tutorial to configure everything, I ran into a weird issue where sudo stopped working properly.
The Problem
Everything was going smoothly until I tried to run the final installation step. When I attempt:
sudo make install
I get this error:
sudo: make: command not found
The strange thing is that sudo was working fine earlier when I was editing the sudoers file. After that point, it just stopped functioning correctly.
What I’ve Tried
Without sudo: I tried running the command without sudo and it seemed to compile for a few minutes, but ultimately failed at the end.
Checking paths: Running which npm shows /usr/local/bin/npm and which sudo returns /usr/bin/sudo, so both seem to be in the right place.
PATH variable: I modified my PATH as suggested in other solutions. Here’s what echo $PATH shows:
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin:/usr/local/bin:/opt/node/bin
Alternative installation: I also attempted the curl method but got permission errors:
curl http://npmjs.org/install.sh | sh
This resulted in:
npm ERR! Error: EACCES, permission denied '/usr/local/bin/npm'
npm ERR! Please try running this command again as root/Administrator.
Questions
- Why did sudo stop working after editing sudoers?
- How can I properly install npm on Amazon Linux?
- Should I be using the ec2-user account or root for this?
Any help would be greatly appreciated. I’m fairly new to Linux administration and this has me completely stuck.