2013-01-06 132 views
1

我试图按照关于如何使用Eclipse的debug node.js applications的说明。但是如下面的屏幕截图所示,断点不会被启用。任何人都可以指出我的解决方案。使用Eclipse调试node.js应用程序

enter image description here

+0

这是您自己的屏幕截图或指令网站的屏幕截图吗? –

+0

我的截图。正如你所看到的那样,在圆圈中有一条线表示断点未被启用。这是我的问题。 –

+0

通过断点的对角线:所有断点已被禁用(按钮跳过断点视图中的所有断点) –

回答

1

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

0

呵呵,你正在使用他们在我阅读的教程中使用的相同的滴答功能。可能是相同的教程。

当我像这样设置Eclipse时发现的另一个有趣的事情是,为了能够调试一个真实的应用程序,您必须延迟它的运行,像股票代码那样,但当然更智能一点。以下是我如何做到目前为止..(希望这也会有所帮助):

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(); 
} 
相关问题