How to kill nodemon process on mac? [closed]
Asked Answered
S

5

14

I am having trouble with exiting past nodemon instance.

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node    98355 user   14u  IPv6 0x51b8b9857a4e56a3      0t0  TCP *:redwood-broker (LISTEN)

It has taken my 3000 port so I am trying to exit it. I searched it by using lsof -wni tcp:3000

I could see that PID is 98335, so tried kill 98335, kill -9 98335, sudo kill 98335, sudo kill -9 98335 and so on but no luck, it's just saying

kill: kill 98335 failed: no such process

But if I save something, nodemon watching job is printing out to console, which means that process is still alive.

Please help me.

Surcingle answered 5/8, 2017 at 10:11 Comment(1)
PID is 98355 - you want to kill 98335 (check number an position of 3s and 5s)Derosa
H
29

https://github.com/remy/nodemon/issues/1386

To work around the issue, find the proces running on the port number and kill it:

 kill -9 $(lsof -t -i:3000)   

OR

Install 1.17.5 npm install [email protected] --save-dev --save-exact.

Hulen answered 19/12, 2018 at 12:10 Comment(1)
yay. this question returned for searching how to kill a node process without process.title. (since process.title doesn't work... anywhere).Garniture
L
13

you can use

ps -ef | grep node

to find the process id

and then

sudo kill -9 <PID>

PID is the process ID. Try the following command in terminal to list and search for process using a regex:-

ps gx | grep 'Symantec'

The above example is to list all the 'Symantec' related processes. Replace 'Symantec' with your own phrase. Next use variations of 'kill' command. You can either use:-

kill pid

Replace 'pid' with actual process id. Or use,

killall

as suggested before. To reiterate another useful suggestion, use

man kill

to see the manual for 'kill' command and also scroll down and see related commands which is mentioned under.

Lachellelaches answered 5/8, 2017 at 10:14 Comment(1)
This should be downvoted into the negatives, because the person who answered clearly doesn't realize that nodemon is something that respawns the instance after it's killed. A general "what does 'kill' do" answer does not apply.Beckmann
L
2

to kill all running node processes with -9 option

sudo pkill -f node -9
Lys answered 11/6, 2020 at 19:35 Comment(0)
N
1
sudo kill -9 PID 

This will forcefully kill your process

Noenoel answered 5/8, 2017 at 10:16 Comment(2)
@BarakShirali, how did you started this process? on terminal ? if yes then press ctrl+c,, it will be stopped.Noenoel
ctrl+c didn't quit it fully unfortunately. If I save a file, nodemon instance restarts againSurcingle
T
-1

you kill wrong PID its 98355 not 98335

Tabu answered 9/9, 2020 at 9:8 Comment(1)
PID depends on your env. each process has it's own ID. These numbers are valid only for the running process while it's running. Even on same machine re-run same thing and it may have different PID each time. Learn more here: en.wikipedia.org/wiki/Process_identifierShelton

© 2022 - 2024 — McMap. All rights reserved.