I created all the files from the lesson and wrote node server.js in the console.

It turns out that:

 events.js:154 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE :::8080 at Object.exports._errnoException (util.js:856:11) at exports._exceptionWithHostPort (util.js:879:20) at Server._listen2 (net.js:1236:14) at listen (net.js:1272:10) at Server.listen (net.js:1368:5) at Server.listen.Server.attach (/Users/doge/node_modules/socket.io/lib/index.js:216:9) at new Server (/Users/doge/node_modules/socket.io/lib/index.js:50:17) at Function.Server (/Users/doge/node_modules/socket.io/lib/index.js:38:41) at Object.<anonymous> (/Users/doge/Desktop/server.js:2:31) at Module._compile (module.js:413:34) 

Tell me how to make it work?

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky
  • Links that offer to look at the problem code in a third-party source are not allowed on StackOverflow in Russian. - Risto

2 answers 2

There is an explicit error: EADDRINUSE
(" E rror: ADDR ess IN USE ", "Error: the address is already taken").

In order to start, you can change the port ( 8080 ) to another: for example, 8081 .

  • Thank you for the answer, you are a kind person! - FRESTAR
  • @FRESTAR "Thank you" we have decided to express by clicking on the arrow up at the answer (the so-called "vote for") and tick the box if this answer led to a decision. - D-side
  • @ D-side In my opinion, after your advice, he jabbed the wrong arrow: D - StateItPrimitive

This is a mistake of the fact that you have already started node.js on this port or the port is busy. If node.js already running on this port, just kill the process with sudo fuser -vk 8080/tcp . If the port is busy, for example, it can be running apache , then run node.js on another port, for example, on 8888 .