Pergunta

On Mint Maya 64, if I run "node index.js" (v0.10.21) in terminal, I get this error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1127:5)
    at Object.<anonymous> (/home/USER/Desktop/server/index.js:73:24)
    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)

my apache2 server is stopped, and there is no other node server running.

I tried "killall node" -> node: no process found

With "sudo netstat -tulpn" there is no sign of anything listening on port 80.

Because it's the first node server experiment for me, I don't have a clue how to proceed.

Foi útil?

Solução

Check which port is used by Node in your index.js file, for a start. There is another application which uses this port. So you have two options:

  • kill this app
  • use another port for Node app

Outras dicas

Clearly, the port is occupied in EADDRINUSE error. As already stated, you either have to use the other port or kill the application.

Other thing you can do is to identify the process that is occupying that particular port and kill that(this really comes handy in some concepts)

You can use fuser utility here.

About Fuser

The fuser command is a very smart UNIX utility used to find which process is using a file, a directory or a socket. It also gives information about the user owning the process and the type of access. The fuser tool displays the process id(PID) of every process using the specified files or file systems.

Providing here one relevant link for fuser.

https://www.digitalocean.com/community/tutorials/how-to-use-the-linux-fuser-command

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top