Chrome 73:无法再使用专用于节点的DevTools调试NodeJS

Ale*_*lov 24 google-chrome node.js google-chrome-devtools

我刚刚将Chrome升级到73.0.3683.75(Linux),现在无法使用专用的Node调试器来实际调试正在运行的实例。即使我可以在控制台中看到“附加了调试器”消息:

$ node --inspect-brk hello.js
Debugger listening on ws://127.0.0.1:9229/864a1c18-5e45-49ab-843c-77a22841ffff
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Run Code Online (Sandbox Code Playgroud)

调试器窗口没有显示任何调试目标的迹象: 专用节点调试器窗口

有人知道Chrome 73是否损坏了它,或者我做错了什么?谢谢!

Moh*_*emy 5

更新

此错误已在 chrome 74.0.3729.61 中修复,请查看此处


您可以使用专为 Node.js 定制的ndb ,它也来自 GoogleChromeLabs。

安装使用

npm install -g ndb

Run Code Online (Sandbox Code Playgroud)

用法:

使用ndb代替节点命令:

    ndb server.js
    # Alternatively, you can prepend `ndb`
    ndb node server.js
Run Code Online (Sandbox Code Playgroud)

在任何其他二进制文件前面添加 ndb:

    ndb npm run unit
    ndb mocha
    ndb npx mocha
Run Code Online (Sandbox Code Playgroud)

将 ndb 作为独立应用程序启动:

    # cd to your project folder (with a package.json)
    ndb .
    # In Sources panel > "NPM Scripts" sidebar, click the selected "Run" button
Run Code Online (Sandbox Code Playgroud)

如果您使用的是nodemon:

 ndb nodemon .
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息,请参阅项目 github 存储库

https://github.com/GoogleChromeLabs/ndb