0

I was exploring node debugger and I am stuck at the problem. I have a debugging.js file with following content

var http = require("http");
function process_request(req, res) {
    var body = 'Thanks for calling!\n';
    var content_length = body.lenggth ;
    res.writeHead(200, {
        'Content-Length': content_length,
        'Content-Type': 'text/plain'
    });
    res.end(body);
}

var s = http.createServer(process_request);
s.listen(8080);

Note that there is an mistake on line 5. This is done intentionally to debug the problem. Now I tried running node using node debug debugging.js. While this didn't gave any error. Calling setBreakpoint(5) resulted in following error.

Warning: script 'undefined' was not loaded yet.

_debugger.js:1399
      var escapedPath = script.replace(/([/\\.?*()^${}|[\]])/g, '\\$1');
                           ^
TypeError: Cannot call method 'replace' of undefined
    at Interface.setBreakpoint (_debugger.js:1399:31)
    at repl:1:1
...

Environment : Debian Linux3.2.0, Node JS - V0.13.0-pre

Can someone tell me, what should be done to resolve this?

I found post, which seems to have similar problem, but it seems to be a year old post and I am not sure whether the fix is available in the node version, I am using.

4

1 回答 1

0

嗯,这似乎是一个问题node V0.13.0-pre,我在 Linux 上使用。我在 Windows 上尝试了相同的代码,node v0.10.33并且运行良好。所有调试命令都按预期工作。

于 2015-01-11T12:57:22.473 回答