是否可以调试节点repl

is it possible to debug node repl

本文关键字:节点 repl 调试 是否      更新时间:2023-09-26

是否有可能调试NODE的REPL。Node CMD带来repl提示符>。在提示符中可以启动调试器。例如

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

新方法:节点8>=

node --debug被标记为弃用。

[DEP0062] DeprecationWarning: node --debug and node --debug-brk are invalid。请用node --inspectnode --inspect-brk代替。

node --inspect是前进的道路。

老方法

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

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