1

I'm trying to run my first Node.js application, but I'm having trouble. This could be an error with the firewall on CPanel, but I'm not sure.

I'm running Node.js version 5.0.0

And this is my js:

var net = require('net');
var server = net.createServer(function (socket) {
    socket.write('Open Serverrn');
    socket.pipe(socket); });
server.listen(674, 'my.ip.add.ress');
console.log('Server running at http://my.ip.add.ress:674/');

And final : this is my notification :

node test.js

Error is:

Server running at http://my.ip.add.ress:674/
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES my.ip.add.ress:674
    at Object.exports._errnoException (util.js:860:11)
    at exports._exceptionWithHostPort (util.js:883:20)
    at Server._listen2 (net.js:1221:19)
    at listen (net.js:1270:10)
    at net.js:1379:9
    at doNTCallback3 (node.js:461:9)
    at process._tickCallback (node.js:367:17)
    at Function.Module.runMain (module.js:459:11)
    at startup (node.js:136:18)
    at node.js:972:3

When I open my console with port 674, it's always loading and timing out after a few seconds. Why is that? Plz help me this issue.

Jess Bowers
  • 2,846
  • 1
  • 22
  • 42
Sunny
  • 11
  • 3
  • I don't know if it'll help but maybe try running the command with "sudo" (if you still didnt) or try changing the port to something like 4000 to see if it runs then. – ChicoDelaBarrio May 14 '16 at 07:29

2 Answers2

0

I do not believe GoDaddy has Node.js support, as per this: How to install nodejs application in Godaddy server

Common hosts for Node apps would be: Digital Ocean, Nodejitsu (owned by GoDaddy anyway), Modulus, Heroku, Joyent, and AWS, I believe.

Community
  • 1
  • 1
Josh Slate
  • 774
  • 5
  • 17
0

You need to use port higher than 1024. To bind lower ports you need root privileges or allow program to bind via setcap - can't be implimented at GoDaddy or other shared hosting.

DronKram
  • 1
  • 1