gpt4 book ai didi

javascript - 是否可以调试 Node repl

转载 作者:行者123 更新时间:2023-11-30 05:34:41 25 4
gpt4 key购买 nike

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

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

最佳答案

新方式: Node 8>=

node --debug 被标记为弃用。

[DEP0062] DeprecationWarning: node --debug and node --debug-brk are invalid. Please use node --inspect or node --inspect-brk instead.

node --inspect 是前进的方向。

老方法

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

如果你想要 coffee-script repl,它是 coffee --nodejs --debug

关于javascript - 是否可以调试 Node repl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24666163/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com