node.js 尝试杀死所有节点但在 osx 上失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19968069/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
try to kill all nodes but failed on osx
提问by arachide
I hope to restart nodejs on mac osx
希望在mac osx上重启nodejs
$ps aux | grep node
mymac 20215 0.0 0.0 2432768 460 s000 R+ 9:49AM 0:00.00 grep node
there is one PID 20215, I try to kill the process
有一个 PID 20215,我尝试终止该进程
kill -2 20215
it reports
它报告
-bash: kill: (20215) - No such process
your comment welcome
欢迎你的评论
回答by jlhonora
There's no other process containing the keyword "node" in your ps auxoutput except from grep node. You're trying to kill the process of greping node, and no node process is running, that's why it fails.
还有一个包含在你的关键词“节点”没有其他过程ps aux的输出,除了从grep node。您正在尝试grep终止 ing node进程,并且没有 node 进程正在运行,这就是它失败的原因。
Try with
试试
sudo killall node
Or
或者
sudo kill -9 `ps aux | grep node | grep -v grep | awk '{print }'`

