In my NodeJS code I put debugger; in a line I'd like to pause on, as specified by the NodeJS docs
...
saveEvent(event, function(event, message) {
console.log("Event Saved!");
// combine
eAll = eMen.concat(eWomen);
debugger;
models.Person.update({"_id": {"$in": eAll}}, {"eventsAttended": {"$push": event._id}}, function(err, updatedPeople){
if (err) console.log(err);
else {
result.message = message;
result.event = event;
callback(result);
}
})
});
However, when I run this (node debug app.js) the console does show something when it reaches this line,
break in C:\Users\Imray\Projects\DaProj\daproj-backend\db.js:415
414
415 debugger;
416 models.Person.update({"_id": {"$in": eAll}}, {"eventsAttended": {"$push": event._id}}, function(err, updatedPeople){
417 if (err) console.log(err);
but when I try checking the value of current variables, I get an error
debug> eAll
ReferenceError: eAll is not defined
at repl:1:2
at Interface.controlEval (_debugger.js:969:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.emit (events.js:98:17)
at emitKey (readline.js:1095:12)
debug>
Why isn't this working as expected?