Coffee to go

Icon

var thisBlog = getGlobalContext().buildFromTemplate(PERSONAL | PROGRAMMING | RANDOM_THOUGHTS);

node.js & Error: listen EACCES

For one of my own ‘technology venture’ I have recently started getting my hand dirty with node.js and mongodb- I followed a great step by step blog post (whose link has got been missing, sorry) about setting up node.js and mongodb on amazon ec2 server and luckily it went smooth and I was able to run node.js web server at port ’80′-

But after couple of days when i resumed from where I stopped last time, did some changes in my webserver to make it more useful rather printing ‘Welcome’ message, when I tried running following command

node my_server.js

It always ended up with following exception:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: listen EACCES
    at errnoException (net.js:642:11)
    at Array.0 (net.js:728:28)
    at EventEmitter._tickCallback (node.js:192:40)

I banged my head quite a while, try changes bits here and there but nothing worked out- so i decided to google it and as always found a similar post and solution posted on StackOverflow- so basically it turned out that Error: listen EACCES occurs when user doesn’t have enough rights to start web server on certain ports- and obviously my ec2-user doesn’t have permission to start server on port ’80′. So for solving this all i did was gave the appropiate rights to logged-in user and … happy ending…

Share on Twitter

Category: Uncategorized

Tagged:

4 Responses

  1. Manolo says:

    Hello, I’m trying the same and I have the same problem. How do you give permission to start server on port 80 to the user?. Many thanks

  2. Manolo says:

    Thanks a lot!!!!

  3. Poshest says:

    Thank you SO much. Sorted me out. sudo node app.js caused error “sudo: node: command not found”, but your post led me to run node under a different port, and then translate that internal port to an external port 80 (using Microsoft IaaS endpoint configuration).

Leave a Reply