我怎么能在nodejs中进行debugging,任何类似于pdb的工具或者Ruby或Python中的pry

我跑了我的脚本

节点debuggingsample.js

它停在目标位置。

不知何故,我不知道如何检查variables。

例如,我想打印出variablesdb ,但它不能。

node.js上任何推荐的debugging器工具

谢谢

sample.js

 // Generated by CoffeeScript 1.9.2 (function() { var MongoClient, print; print = require('awesome-print'); MongoClient = require('mongodb').MongoClient; MongoClient.connect('mongodb://localhost:27017/test', function(err, db) { debugger; db.command({ listCollections: 1 }, function(err, o) { debugger; return print(o["cursor"]); }); }); }).call(this); 

例外

  20 21 }); debug> print(db) repl:1 print(db) ^ ReferenceError: print is not defined at repl:1:1 at Object.exports.runInContext (vm.js:64:17) at Interface.controlEval (_debugger.js:975:21) at bound (domain.js:254:14) at REPLServer.runBound [as eval] (domain.js:267:12) at REPLServer.<anonymous> (repl.js:279:12) at REPLServer.emit (events.js:107:17) at REPLServer.Interface._onLine (readline.js:214:10) at REPLServer.Interface._line (readline.js:553:8) at REPLServer.Interface._ttyWrite (readline.js:830:14) debug> db repl:1 db ^ ReferenceError: db is not defined at repl:1:1 at Object.exports.runInContext (vm.js:64:17) at Interface.controlEval (_debugger.js:975:21) at bound (domain.js:254:14) at REPLServer.runBound [as eval] (domain.js:267:12) at REPLServer.<anonymous> (repl.js:279:12) at REPLServer.emit (events.js:107:17) at REPLServer.Interface._onLine (readline.js:214:10) 

您可能正在命令行debugging器中查找“repl”命令。 同样, node-inspector是将chrome的真棒devtools连接到节点进程的好方法。 您可以在我的博客文章中了解如何使用node-inspector :使用debugging器点亮您的javascript

您可能想要尝试CodeLite IDE (一种免费的跨平台开源IDE)。 从版本8.1开始,我们完全支持debuggingNode.js应用程序