Can't stop local node server with Ctrl + C (Mac)

寵の児 提交于 2019-12-11 14:29:06

问题


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...

回答1:


Because you're using OSX, type Ctrl+C instead of Cmd+C.




回答2:


In addition to Pat Needham's answer, Also check Apple Logo > System Preferences > Keyboard > Shortcuts. If you enable any unchecked item and enter ctrl+c, then it will show which one has also ctrl+c.



来源:https://stackoverflow.com/questions/45133138/cant-stop-local-node-server-with-ctrl-c-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!