节点调试 - 未定义的错误
Node debug - undefined error
我正在探索节点调试器,但遇到了问题。我有一个包含以下内容的 debugging.js
文件
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);
请注意,第5行有一个错误。这是为了调试问题而故意这样做的。现在我使用 node debug debugging.js
尝试 运行 节点。虽然这没有给出任何错误。调用 setBreakpoint(5)
导致以下错误。
Warning: script 'undefined' was not loaded yet.
_debugger.js:1399
var escapedPath = script.replace(/([/\.?*()^${}|[\]])/g, '\');
^
TypeError: Cannot call method 'replace' of undefined
at Interface.setBreakpoint (_debugger.js:1399:31)
at repl:1:1
...
环境:Debian Linux3.2.0, Node JS - V0.13.0-pre
谁能告诉我,应该怎么做才能解决这个问题?
我找到了post,好像也有类似的问题,但是好像有一年了post,我不确定node版本是否有修复,我是使用。
看来是 node V0.13.0-pre
的问题,我在 Linux 上使用。我在 Windows 和 node v0.10.33
上尝试了相同的代码并且运行良好。所有调试命令都按预期工作。
我正在探索节点调试器,但遇到了问题。我有一个包含以下内容的 debugging.js
文件
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);
请注意,第5行有一个错误。这是为了调试问题而故意这样做的。现在我使用 node debug debugging.js
尝试 运行 节点。虽然这没有给出任何错误。调用 setBreakpoint(5)
导致以下错误。
Warning: script 'undefined' was not loaded yet.
_debugger.js:1399
var escapedPath = script.replace(/([/\.?*()^${}|[\]])/g, '\');
^
TypeError: Cannot call method 'replace' of undefined
at Interface.setBreakpoint (_debugger.js:1399:31)
at repl:1:1
...
环境:Debian Linux3.2.0, Node JS - V0.13.0-pre
谁能告诉我,应该怎么做才能解决这个问题?
我找到了post,好像也有类似的问题,但是好像有一年了post,我不确定node版本是否有修复,我是使用。
看来是 node V0.13.0-pre
的问题,我在 Linux 上使用。我在 Windows 和 node v0.10.33
上尝试了相同的代码并且运行良好。所有调试命令都按预期工作。