Error: listen eaddinuse: 4000 [How to Solve]

Recently took over an old angular1.6 project and encountered many problems in the development process, both at the code level and at the management level.
Let’s record the problems encountered when running the code
[15:45:15] Starting ‘startserver’…
Start webserver……
events.js:165
throw er; // Unhandled ‘error’ event
^
Error: listen EADDRINUSE :::4000
at Server.setupListenHandle [as _listen2] (net.js:1346:14)
at listenInCluster (net.js:1387:12)
at Server.listen (net.js:1475:7)
at Object. (D:\TeaGarden\ShareTeams\TeaGarden\WEB_Code\Client101901\app.js:52:8)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
Emitted ‘error’ event at:
at emitErrorNT (net.js:1366:8)
at process._tickCallback (internal/process/next_tick.js:178:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:697:11)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
[15:45:16] ‘startserver’ errored after 1.4 s
[15:45:16] Error in plugin “gulp-shell”
Message:
Command node --nolazy app.js failed with exit code 1

Find the cause.
Node.js port conflict: LISTEN EADDRINUSE :::4000

There are two solutions.
1. change the port number
2. kill the process occupying port 4000
Find the process occupying the port.
netstat -ano |findstr 4000

Similar Posts: