title: Node EADDRINUSE error - a real solution?
body: <p>I'm running node on ubuntu and I keep getting the "error opening port: 8080...", the EADDRINUSE error.</p>
  
  <p>I understand basically what the problem is, but when I search for search for solutions, I basically get debates about the best way to kill the process. The other thing is people saying that you need to use <kbd>ctrl</kbd>+<kbd>c</kbd> instead of <kbd>ctrl</kbd>+<kbd>z</kbd> - that is not an issue because I always use <kbd>ctrl</kbd>+<kbd>c</kbd> and I get this error even when nodemon restarts the server.</p>
  
  <p>Is there a real solution to this? Having to kill the process each time is clumsy and ugly. Plus, I am having to do this 20 times an hour. To make matters worse, this sometimes kills my Postman when I kill the process.</p>
  
  <p>So, is there a <strong><em>real</em></strong> solution. In order of preference:</p>
  
  <ol>
  <li><p>Is there a way to keep this from happening in the first place? Why doesn't node or nodemon kill the process it was running?</p></li>
  <li><p>It there are way to problematically (in my node server) telling it to kill the process before the server crashes/exits?</p></li>
  <li><p>Is there a way to kill existing processes within my server, before it starts listening on the port? I don't like this solution, but it's better that having to pound the port with a hammer every time so I can get it to work.</p></li>
  </ol>
  
  <p>EDIT:</p>
  
  <p>This is the error:</p>
  
  <pre><code>error opening port: 8080
  { Error: listen EADDRINUSE :::8080
      at Object._errnoException (util.js:1022:11)
      at _exceptionWithHostPort (util.js:1044:20)
      at Server.setupListenHandle [as _listen2] (net.js:1351:14)
      at listenInCluster (net.js:1392:12)
      at Server.listen (net.js:1476:7)
      at Function.listen (/home/ksjazzguitar/Programming/test/jwt5/server/node_modules/express/lib/application.js:618:24)
      at Object.&lt;anonymous&gt; (/home/ksjazzguitar/Programming/test/jwt5/server/server.js:46:5)
      at Module._compile (module.js:643:30)
      at Object.Module._extensions..js (module.js:654:10)
      at Module.load (module.js:556:32)
      at tryModuleLoad (module.js:499:12)
      at Function.Module._load (module.js:491:3)
      at Function.Module.runMain (module.js:684:10)
      at startup (bootstrap_node.js:187:16)
      at bootstrap_node.js:608:3
    code: 'EADDRINUSE',
    errno: 'EADDRINUSE',
    syscall: 'listen',
    address: '::',
    port: 8080 }
  </code></pre>