4

I am trying to debug my code using node-inspector but I am getting this error in my Terminal window again and again

$ sudo sails debug
info: Running app in debug mode...
info: You probably want to install / run node-inspector to help with debugging!
info: https://github.com/node-inspector/node-inspector

info: ( to exit, type <CTRL>+<C> )

    Error: listen EADDRINUSE
        at exports._errnoException (util.js:746:11)
        at Agent.Server._listen2 (net.js:1156:14)
        at listen (net.js:1182:10)
        at Agent.Server.listen (net.js:1267:5)
        at Object.start (_debugger_agent.js:20:9)
        at startup (node.js:86:9)
        at node.js:814:3

To resolve

Error : listen EADDRINUSE

I have tried closing other Terminal window (in which my node-inspector was running). I have referred to the answers already here on StackOverflow but they didn't work I have even tried giving this command to kill processes :

$ killall -9 node 
No matching processes belonging to you were found

but still its not working. Somebody please help me out with this.

Community
  • 1
  • 1
Prerna Jain
  • 1,053
  • 2
  • 14
  • 30

3 Answers3

5

I see that you are using sudo so this is not a permissions issue.

It definitely seems like the port is already in use. You should check to see which process is using the port, then kill that process.

Codebling
  • 6,340
  • 2
  • 28
  • 52
  • Thanks @CodeBling I am running it on mac and i had tried to kill that individual process which is using the port but that also didn't work. – Prerna Jain Jul 20 '15 at 08:04
  • @PrernaJain I see that you tried `killall -9` in the question above. Did you try `-9` when killing the individual process, and it still exists? In that case, have a look [here](http://stackoverflow.com/questions/16944886/how-to-kill-zombie-process), it's likely a zombie process (note the 'Z' flag). – Codebling Jul 20 '15 at 17:08
  • Yeah it was actually acting as a zombie process and this was helpful, it works well for me. Thanks once again @Code – Prerna Jain Jul 21 '15 at 05:07
  • and yeah, i'll accept your answer now and hopefully my question made it more clear to you, the concepts of 'Z'ombie processes,as it does for me. – Prerna Jain Jul 21 '15 at 05:13
  • Man! you save my 1 hour of debugging. Thanks – Jahanzaib Aslam Oct 06 '15 at 07:23
  • @JahanzaibAslam Awesome! That's what StackOverflow is for! – Codebling Oct 07 '15 at 21:06
4

There is a known issue with using sails debug on Node v12.0. There's a patch which will be released with the next version of Sails (v0.12).

In the meantime you can either install the edge version of Sails from Github or apply the patch yourself by replacing your Sails' /lib/hooks/grunt/index.js file with the contents of https://raw.githubusercontent.com/balderdashy/sails/88ffc0ed9949f8c74ea390efb5610b0e378fa02c/lib/hooks/grunt/index.js.

sgress454
  • 24,687
  • 4
  • 71
  • 91
1

First, find your task that uses port 1337:

netstat -ano | findstr : 1337 (port number)

Then kill it:

tskill (process ID (PID))

It can solve your problem

Mahdi GB
  • 65
  • 2
  • 9