LoginSignup
142
111

More than 5 years have passed since last update.

node.js起動時エラー : Error: listen EADDRINUSE

Last updated at Posted at 2014-07-15

事象

さっき動いていたのに、
node app.jsで起動しようとしたら、下記エラーが。

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 Function.app.listen (/vagrant/girly/girly-batch/node_modules/express/lib/application.js:532:24)
    at Object.<anonymous> (/vagrant/girly/girly-batch/bin/www:7:18)
    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)

原因

すでにそのポート使ってるよって怒られいるんです。

解決

既存プロセスを探して死んでもらう。
再度起動する。

$ ps aux | grep node
vagrant  14761  0.0  2.0 704016 38520 pts/0    Sl+  01:22   0:01 node app.js
vagrant  15069  0.0  0.0 107456   908 pts/2    S+   01:59   0:00 grep --color=auto node

$ sudo kill -9 14761
$ node app.js
142
111
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
142
111