0

I'm using Linux Mint 14.

I've created the chatroom app described in "Node.js in action" Chapter 2. However the

chatServer.listen(server);

in server.js causes this error:

nodejs server.js
 info  - socket.io started
 warn  - error raised: Error: listen EACCES

events.js:72
      throw er; // Unhandled 'error' event
          ^
Error: listen EADDRINUSE
  at errnoException (net.js:904:11)
  at Server._listen2 (net.js:1042:14)
  at listen (net.js:1064:10)
  at Server.listen (net.js:1138:5)
  at Object.<anonymous> (/home/andrew/Google   Drive/AJRComp/Src/JavaScript/Node.js/NodejsInAction/chatrooms/server.js:55:8)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)

Googling for this there does seem to be the same question asked on Mar 18, but it only comes up in the Google search, I can't seem to find it on the stackoverflow site (could it have been deleted).

The only solution I've found to do with this error using socket.io is to do with having to run as root if the port numbers are less than 1024, but I'm listening on 3000.

Using nmap localhost, port 3001 is reported as open and used by the nessus service. But I don't seem to have Nessus installed. So could there be some kind of port protection that's stopping my app listening on that port??

Thanks in advance.

Andrew Roberts
  • 2,374
  • 1
  • 12
  • 25
  • Since you are getting EADDRINUSE this might help http://stackoverflow.com/questions/4075287/node-express-eaddrinuse-address-already-in-use-kill-server – Hector Correa Apr 03 '14 at 20:18

2 Answers2

0
Error: listen EADDRINUSE

This mean Error Address already in use. There is something else running on same port where you want to want the nodejs server.

lsof -i:<port>

will give you the information regarding the process running on the port.

Sriharsha
  • 2,120
  • 1
  • 14
  • 19
0

I finally managed to track this down (on Cloud9, I didn't go back and try it on localhost). I used

$ fuser 3000/tcp

to check if that port was used, and then

$ fuser -k 3000/tcp

to close that process.

(And as an aside I had to update the jquery file used to the latest version to get the chat app to actually work).

Andrew Roberts
  • 2,374
  • 1
  • 12
  • 25