0
在我的代碼的NodeJS我把debugger;
一條線,我想暫停時,由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);
}
})
});
但是指定,當我運行這個( node debug app.js
)控制檯確實顯示,當它到達此行的東西,
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);
但是當我嘗試檢查當前變量的值,我得到一個錯誤
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>
爲什麼不按預期工作?