Error code: events.js:183 Thrower; //unhandled ‘error’ event – solution

"F:\develop\tools\editor\WebStorm2017\WebStorm 2017.3.5\bin\runnerw.exe" F:\develop\tools\develop\node\node.exe H:\webstorm\blog\app.js
Database connection successful
      throw er; // Unhandled 'error' event

Error: listen EADDRINUSE :::8080
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046: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 (H:\webstorm\blog\node_modules\express\lib\application.js:618:24)
    at H:\webstorm\blog\app.js:52:13
    at promise.then (H:\webstorm\blog\node_modules\mongoose\lib\connection.js:414:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Process finished with exit code 1

Reason for error:

Port number is occupied

looks up the occupied port number and closes it

1.Win+R,cmdTo find out if the port number used is occupied.
netstat -ano|findstr "8080"
Press Enter to display the PID number of the corresponding program occupying port 8080.
2. find the corresponding program according to the PID number: continue to enter the command.
tasklist|findstr "15008"
The program occupying the port is displayed after pressing enter.
3. Press the shortcut key "Ctrl+Shift+Esc" to bring up Windows Task Manager, according to the PID/
It is enough to end the program process with the corresponding name of the program.

Translated with (free version)

Read More: