I'm using EC2 with their Amazon Linux AMI. There is no way to login as root for security reasons. I installed node.JS with no problem but failed with the Node Package Manger. When using curl without sudo it fails because userrights are missing, if you use sudo it fails because it thinks node is missing. Tried get and make install too, but this fails also (don't know where to look up why...) Has anyone finished installing npm with sudo only?

  • Have you checked to make sure node.JS is in your path? It could be npm can't find it because it was installed where npm isn't expecting it. – Wilshire Jul 1 '11 at 21:51

Why don't you just type

sudo su

at the command line to get a root prompt? This is confirmed to work with the latest Amazon Linux AMI...



In my case it makes no difference if you switch to a root prompt first or do it in one line, it both results in 'npm cannot be installed without node'.


That does the trick. So I've done the following to make it work

sudo su
export PATH
curl http://npmjs.org/install.sh | sh

I don't know where npm expects node to be, maybe just using 'home/ec2-user/node' wasn't a good idea...?!

Thanks to all for their response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.