Using the node inspector, I cannot set a breakpoint in the following node.js code. (Content main.js )
(function() { require('underscore'); var doSomething = function(callback) { callback('doSomething Finished'); } doSomething(function(x) { console.log(x); }); }).call(this);
I can easily set a breakpoint on line 2, line 4 or line 8, however no matter how hard I try, the debugger does not allow me to set a breakpoint on line 5 or line 9. To be clear, m, using the following commands to run node - inspector
node --debug-brk main.js node-inspector
I also tried to debug a web storm, but the problem persists. If I remove the string require('underscore'); , the problem will disappear immediately, and I can again set a breakpoint inside the function body. The problem also disappears if I remove the outermost closure function. It appears that the interaction between require and file-level closure minimizes node debugging functionality. Has anyone experienced this problem on their own and / or knows any workarounds to be able to break functions inside the body?
EDIT: My version of node js
Tony:~ $ node --version v0.10.12 Tony:~ $
source share