You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在WebStorm/VS Code或Node.js中忽略debugger;语句?

解决动态生成debugger语句的调试干扰问题

WebStorm

  1. 使用Node.js参数:在调试配置的「Node options」中添加 --ignore-debugger,启动调试后Node会自动忽略所有debugger;语句,包括动态生成的。
  2. IDE内置设置:打开「Settings」→「Build, Execution, Deployment」→「Debugger」→「Stepping」,勾选「Ignore 'debugger' statements」,调试时会跳过所有debugger断点。

VS Code

  1. 配置skipFiles:打开.vscode/launch.json,在对应调试项中添加 "skipFiles": ["**/eval/*.js", "<node_internals>/**"],VS Code会跳过eval动态生成的代码,避免触发其中的debugger。
  2. 结合Node参数:在launch.json的runtimeArgs数组里加入 "--ignore-debugger",让Node全局忽略所有debugger语句。

纯Node.js命令行方案

无需依赖IDE,直接在启动命令中添加--ignore-debugger参数即可:

node --inspect --ignore-debugger your-app.js

该参数会禁用所有debugger;语句的触发,彻底解决动态生成代码的干扰。

内容的提问来源于stack exchange,提问作者chuacw

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 03:22:35