2012-12-18 50 views
44

我正在嘗試使用節點調試器。 我正在運行node debug server來運行我的服務器。然後我有:使用節點的內置調試器檢查變量?

... 
var Workspace = mongoose.model('Workspace'); 
debugger; 

在這一點上,正如所料,當我運行此代碼時,調試器彈出。但是,我希望它具有所有當前變量設置,就像它在Chrome自己的調試器中發生的一樣。

但是:

break in hotplate/node_modules/bd/lib/bd.js:133 
132 
133 debugger; 
134 
135 // Delete the ID and the version since there's no point, 
debug> Workspace 
ReferenceError: Workspace is not defined 

所以...我怎麼實際上檢查當前的變量?

獎金問題:是否有任何方式使用Chrome的開發人員工具(CTRL-J),以便它連接到節點並以此方式工作? (我知道節點檢查的,但它是非常過時的,...)

回答

70

使用repl命令(見docs第三個例子)

break in hotplate/node_modules/bd/lib/bd.js:133 
132 
133 debugger; 
134 
135 // Delete the ID and the version since there's no point, 
debug> repl 
Press Ctrl + C to leave debug repl 
> Workspace 

更新:獎金問題 - https://github.com/c4milo/node-webkit-agent

+0

什麼獎金問題? :D – Merc

+0

不確定是否有其他可用的解決方案,然後您可以嘗試使用Chrome開發人員工具遠程調試器 - https://developers.google.com/chrome-developer-tools/docs/remote-debugging –

+2

在更新:)看到獎金問題的答案:) –

相關問題