1
votes

I've set up my first EC2 instance today to play around with node.js and mongo db. I followed this guide http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/

as I had no idea what flavor of Linux "Amazon Linux" was. I got all the way through with no problems, until the very last step (none of this server stuff ever works the first time does it?).

I went to 'sudo make install' and get 'sudo: make: command not found'. In the above article, you are told to edit the sudoers, which is the last time I can remember sudo working. After that, no dice. I even tried not including 'sudo' and it seemed to work, taking a few minutes to compile, but at the end, it failed. However, if I type 'which npm' I get '/usr/local/bin/npm'.

I know what you're asking: "Did you log in as the root user?"

  1. I try root, and I am told to use ec-user instead, which I do. So, I dunno.

  2. If there is somewhere in the AWS console where this is listed, I'm 100% unaware of its location.

'which sudo' returns '/usr/bin/sudo'

I even tried modifying $PATH as I've seen in a few similar solutions. echo returns

/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

Frustrated, I saw that you should be able to install using 'curl http://npmjs.org/install.sh | sh'. (See here https://gist.github.com/1232821 and here http://www.embracingthecloud.com/2010/12/05/InstallingNodejsOnAmazonEC2.aspx

I don't think this has ever worked for me, even locally on Mac. Here's the output:

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 101 7881 101 7881 0 0 67597 0 --:--:-- --:--:-- --:--:-- 148k tar=/bin/tar version: tar (GNU tar) 1.23 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason. install [email protected] fetching: http://registry.npmjs.org/npm/-/npm-1.1.2.tgz 0.6.11 1.1.2 cleanup prefix=/usr/local

All clean!

npm ERR! Error: EACCES, permission denied '/usr/local/bin/npm'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR!
npm ERR! System Linux 2.6.35.14-97.44.amzn1.x86_64
npm ERR! command "/usr/local/bin/node" "/tmp/npm.1554/package/cli.js" "rm" "npm" "-gf"
npm ERR! cwd /tmp/npm.1554/package
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.2
npm ERR! path /usr/local/bin/npm
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/bin/npm'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/npm.1554/package/npm-debug.log
npm not ok
npm ERR! error installing [email protected]
npm ERR! error rolling back [email protected] Error: EACCES, permission denied '/usr/local/bin/npm'

npm ERR! Error: EACCES, permission denied '/usr/local/bin/npm'
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR!
npm ERR! System Linux 2.6.35.14-97.44.amzn1.x86_64
npm ERR! command "/usr/local/bin/node" "/tmp/npm.1554/package/cli.js" "install" "-gf"
npm ERR! cwd /tmp/npm.1554/package
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.2
npm ERR! path /usr/local/bin/npm
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/bin/npm'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/npm.1554/package/npm-debug.log
npm not ok
It failed

SUPER bummed that this isn't working. Yes, I'm a UNIX newb, but I can't be the only person having this issue. I've looked for hours and NOTHING. I can't use 'sudo' on anything*. I always, always get 'sudo: make: command not found' now.

HALP.

*Yes I know some say you're not supposed to install node/npm as root now, but I can never get a straight answer why.

2

2 Answers

1
votes

Let's get back to your first problem. sudo: make: command not found. Sudo is working fine, 'make' is not there. EC2's "AMI Linux" is based on RHEL 5.x.

sudo yum install make glibc-devel gcc

Also, see this thread: https://serverfault.com/questions/204893/aws-ec2-and-build-essential

I personally would avoid the standard AMI Linux. It really is not setup well for doing custom work, or 'new' things like node.js. There are tons of other instances ready to go which will fit your needs better.

0
votes

For your NPM problem, I just did "npm install forever" and it worked fine. I guess it's not global? I'm a noob at this stuff too.