问题
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