使用Eclipsedebuggingnode.js应用程序

我正在尝试遵循关于如何使用Eclipse debuggingnode.js应用程序的说明。 但是如下面的截图所示,断点不会被启用。 任何人都可以指出我的解决scheme。

在这里输入图像描述

看起来你的断点是禁用的。 通过在断点视图中取消选中跳过所有断点来启用它。

嘿,你正在使用我在阅读的教程中使用的同样的滴答function。 可能是相同的教程。

另外一个有趣的事情是我在设置Eclipse时发现,为了能够debugging一个真正的应用程序,您必须像运行时那样延迟运行,当然还要更聪明一些。 以下是我如何做到这一点..(希望这也会有所帮助):

function __myapp_start() { console.log('Running app ...'); // run your app here ... }; if (process.argv[2] === '-dbg') { // `node --debug myapp.js -dbg` wait for the debugger to connect. function __myapp_pause() { var paused = new Date().getTime(); debugger; // will return immediately if the debugger is not connected yet var started = new Date().getTime(); if (started - paused < 500) { // if we returned relatively quickly, assume we're not connected and loop setTimeout(__myapp_pause, 500); } else { // the debugger actually paused and took time to return; we're connected. run. __myapp_start(); } } __myapp_pause(); // attempt to pause the debugger until it actually does pause, then continue } else { // normal production path __myapp_start(); }