I'm running terminal in webstorm. I try running node --harmony app.js and says my koa app.listen() is already running.
So I try to hunt and see what node processes are running via the command ps aux | grep node
I see a couple results:
myUserName 897 0.0 0.0 3083844 160 s000 T 11:15AM 0:00.32 node --harmony app.js
myUserName 1935 0.0 0.0 2441988 676 s000 S+ 1:33PM 0:00.00 grep node
I try to kill 897 by doing a kill 897 or pkill 897 but it is still running. How do I get that to kill!!!??
EADDRINUSE means that the port number which listen() tries to bind the server to is already in use. So, in your case, there must be running a server on port 80 already. If you have another webserver running on this port you have to put node. js behind that server and proxy it through it.
To kill the main Node process, we just pass the pid of the main process. To see this in operation, replace the setTimeout function in our previous code example with this version that uses process. kill . This method also works in the REPL as well as in Node.
Method 1: Using ctrl+C key: When running a program of NodeJS in the console, you can close it with ctrl+C directly from the console with changing the code shown below: Method 2: Using process. exit() Function: This function tells Node. js to end the process which is running at the same time with an exit code.
kill -9 897
kill command sends a signal to the given process, but unless you use -9 which sends the SIGKILL
signal, the process is allowed to attempt to kill itself.
fuser -k 4060/tcp
where 4060 is the port on which your node server is running.
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