gpt4 book ai didi

javascript - 无法让 Node 调试工作

转载 作者:IT老高 更新时间:2023-10-28 23:16:50 28 4
gpt4 key购买 nike

这感觉真的很傻,但我无法让 Node 检查器/node-debug 工作。

说明说要执行 npm install 然后运行 ​​node-debug web.js。所以我就这么做了。现在我打开了一个可爱的浏览器窗口,向我展示了带有断点的代码......并且不知道使用哪个 url 来实际访问代码。

检查器位于 http://localhost:8080/debug?port=5858 并且终端显示:

> node-debug web.js
debugger listening on port 5858
Node Inspector is now available from http://localhost:8080/debug?port=5858
Debugging `web.js`

...

我尝试访问 localhost:5000 (这是我的 express.js 端口),但如果我没有单独的 则失败node web.js 实例正在运行,或者如果我有另一个正在运行但没有触发检查器中的任何断点,它会成功。

当我转到 http://localhost:5858/ 时,我得到:

Remote debugging session already active

当我转到 http://localhost:8080/ 时,我得到:

Cannot GET /

(一般来说,/ 路径完全可以在我的服务器上运行。)

最佳答案

默认情况下 node-debug--debug-brk 模式启动应用程序。这会在第一行停止您的应用程序( express 未启动)。

您可以使用 node-debug --no-debug-brk 查看 node-debug --h 了解更多信息。

关于javascript - 无法让 Node 调试工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23437251/

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