node.js - 清除 Node 调试器中的所有断点

标签 node.js node-debugger

我使用 setBreakpoint(3) 设置了一个新断点(其中 3 是行号)。

如果我想删除它,我可以使用 clearBreakpoint(3),但是如何删除以这种方式添加的所有断点

最佳答案

这并不理想,但它确实有效。您可以使用以下内容 - 我将其保留为单行,因此您可以轻松复制它。注意:输出很丑陋,但它有效。

var i=500; while(i--){clearBreakpoint('/path/to/file/with/breakpoints.js', i); }

当然,首先确保将 i = 设置为文件中的行数,或者至少是最后一行带有断点的行数,以及您自己的文件路径。注意:如果在设置断点时没有指定文件名,则可能不需要指定文件名。

为便于阅读而扩展:

var i = 500;  // number of lines in file

while(i--){
   // in my experiments, you *must* use the filename, but
   // I had defined my filename when I set the breakpoints
   clearBreakpoint('/path/to/file/with/breakpoints.js', i);
}

关于node.js - 清除 Node 调试器中的所有断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22483119/

相关文章:

node.js - 如何在 Heroku 部署的 `npm install && bower install` 之前运行 `sbt compile`?

linux - 如何在 CygWin 上使用连接代理

javascript - 在 MysQl NodeJS 查询上转义数据数组的最佳方法

node.js - 我在安装 noodle.js 时遇到此错误

javascript - 无法使用 "main"执行页面但使用显式路径

node.js - 无法将 Chrome 打开到正确的 url 以调试 Node.js 脚本

node.js - 使用 node-inspector 或 babel-node-debug 调试 es6 转译后的代码

javascript - 如何使用 Node 调试器查看 JavaScript 映射的内容?

javascript - 无法让 Node 调试工作