无法使用 Ctrl + C 停止本地节点服务器 (Mac) [英] Can't stop local node server with Ctrl + C (Mac)
本文介绍了无法使用 Ctrl + C 停止本地节点服务器 (Mac)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在本地开发节点服务器时从未遇到过这个问题.它可能是在更新 xCode 后启动的.
我尝试了最简单的代码
var app = express();var server = app.listen(process.env.PORT || '3000', '0.0.0.0', function() {console.log('App 正在监听 http://%s:%s', server.address().address, server.address().port);});process.on('SIGINT', function() {console.log("退出中...");process.exit();});
但是当我尝试 Ctr+C 退出时无法观察到任何日志.
更新当我尝试按住 3-4 秒时,它起作用了..很奇怪,因为在不按住的情况下按 10-20 次不起作用
App 监听 http://0.0.0.0:3000cccccccccccccccccccccccccccccccccccccccccccc^Cexiting...
解决方案
因为您使用的是 OSX,请键入 Ctrl+C
而不是 Cmd+C
.>
I have never had this problem when developing node server locally. It may have started after updating xCode.
I tried with the simplest code
var app = express();
var server = app.listen(process.env.PORT || '3000', '0.0.0.0', function() {
console.log('App listening at http://%s:%s', server.address().address, server.address().port);
});
process.on('SIGINT', function() {
console.log("Exiting...");
process.exit();
});
but can't observe any log when I try Ctr+C to quit.
UPDATE When I tried pressing and holding 3-4 seconds it worked ..weird because pressing 10-20 times without holding didn't work
App listening at http://0.0.0.0:3000
cccccccccccccccccccccccccccccccccccccccccccccc^CExiting...
解决方案
Because you're using OSX, type Ctrl+C
instead of Cmd+C
.
这篇关于无法使用 Ctrl + C 停止本地节点服务器 (Mac)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文