2

是否可以调试 NODE REPL。node cmd 带来 repl 提示 >. 在提示符下可以启动调试器。比如说

> hello = function(){
....debugger;
....console.log('hello');
}
>hello() --> should run in the debugger..
4

1 回答 1

1

是的

新方式:节点 8 >=

node --debug被标记为弃用。

[DEP0062] 弃用警告:node --debug并且node --debug-brk无效。请使用node --inspectornode --inspect-brk代替。

node --inspect是前进的方向。

老路

node --debug. 然后,您可以node-inspector从单独的终端使用(一个 npm 包),并通过在 chrome 中打开使用 chrome 开发人员工具在浏览器中进行调试http://localhost:8080/debug?port=5858。例如,你可以repl.js在函数中的文件中设置断点complete,如果你去节点 repl 并点击TAB它,它会触发断点,你可以调试它。

如果你想要咖啡脚本 repl,它是coffee --nodejs --debug.

于 2014-07-10T01:52:21.447 回答