脚本宝典收集整理的这篇文章主要介绍了直接在Chrome DevTools调试Node.js,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
英文好的,直接看原文
https://blog.hospodarets.com/...
1 要求
- Node.js 6.3+
- Chrome 55+
2 操作步骤
- 1 打开连接
chrome://flags/#enable-devtools-experiments
- 2 开启
开发者工具实验性功能
- 3 重启浏览器
- 4 打开 DevTools Setting -> Experiments tab
- 5 按6次shift后,隐藏的功能会出现,勾选"Node debugging"
3 运行程序
必须要有 --inspect
> node --inspect www
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/78a884f4-8c2e-459e-93f7-e1cbe87cf5cf
将这个地址粘贴到谷歌浏览器:chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/78a884f4-8c2e-459e-93f7-e1cbe87cf5cf
程序后端输出的日志也回输出到谷歌浏览器的console里面,同时也可以在Sources里进行断点调试了。
以上是脚本宝典为你收集整理的直接在Chrome DevTools调试Node.js全部内容,希望文章能够帮你解决直接在Chrome DevTools调试Node.js所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。