Playing around Microsoft's botframework, when I try to run the app.js file, which is the main file of the bot, the first time is fine, after I close the bot emulator, and all programs, and run the app.js again, this error message pops out
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3978
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at Server.listen (net.js:1476:7)
at Server.listen (C:\Users\yu\Documents\GitHub\BotBuilder-
Samples\Node\cards-AdaptiveCards\node_modules\restify\lib\server.js:404:32)
at Object.<anonymous> (C:\Users\yu\Documents\GitHub\BotBuilder-
Samples\Node\cards-AdaptiveCards\app.js:10:8)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
I found some solution to this, It looks like the port 3978 was taken when I run the js file for the second time, and I have to use cmd to find which task is using that port, and then kill the task.
C:\>netstat -aon|findstr 3978
so this one is taking the port, although I already closed all programs
TCP 0.0.0.0:3978 0.0.0.0:0 LISTENING 13140
TCP [::]:3978 [::]:0 LISTENING 13140
actually it is node.exe itself, it still running at background
C:\Users\yu>tasklist|findstr 13140
node.exe 13140 Console 1 42,064 K
and I need to kill it
C:\Users\yu>taskkill /f /t /im node.exe
Is there a way to not always repeat doing this when I want to run the file more than one time, it just starts to go wired today, and I mean for all different app.js files, include offical sample code. For the past one month, everything was fine, the IDE I am using is sublime text 3, node.js version is 8.9.4 lts
If you are on mac, to make sure nothing is running on the same port, do:
killall node
and restart your app.
The port you are listening to is already being listened by another process.
When I faced to this error I killed the process using Windows PowerShell (because I used Windows)
ps
and then you can get list of processesStop-process <Id>
I think that it is help for windows users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With