【发布时间】:2015-01-26 17:10:00
【问题描述】:
我想调试一个基本上是简单的文本处理管道的应用程序。在搞砸了node-debug 一段时间后(Vagrant 端口转发问题),我在浏览器中得到的所有输出如下:
Type: connect
V8-Version: 3.14.5.9
Protocol-Version: 1
Embedding-Host: node v0.10.25
Content-Length: 0
Content-Length: 96
{"seq":0,"request_seq":1,"type":"response","command":"disconnect","success":true,"running":true}Content-Length: 553
没有调试 GUI。
如果 nodeJS 应用程序不运行 Web 服务器,是否真的可以通过这种方式调试它?
我是这样开始node-debug的:
coffee --nodejs --debug-brk toLineString.coffee
编辑
按照@Brad 的建议,我走得更远了,但它仍然不太奏效:
$ coffee --nodejs --debug-brk toLineString.coffee
debugger listening on port 5858
在另一个选项卡中: $节点调试 info - socket.io 开始
现在,在浏览器窗口中,我转到http://localhost:8080/debug?port=5858
![enter image description here][1]
不过只有样板函数,没有我的代码(反正我可以看到)。
如果我从调试器中“运行”,我迄今暂停的进程将完成。
debugger listening on port 5858
2013-10-31 15h41m21s GPS Module 1 2110_WIMMERA HWY _F_S1_0_125140 001.gps
->2013-10-31 15h41m21s GPS Module 1 2110_WIMMERA HWY _F_S1_0_125140 001.json
2013-12-16 12h12m49s GPS Module 1 2170_HYLAND HWY _F_S1_0_59840 001.gps
->2013-12-16 12h12m49s GPS Module 1 2170_HYLAND HWY _F_S1_0_59840 001.json
=> all-lines.json
vagrant@vagrant-ubuntu-trusty-64:/vagrant/test$
node-debug 进程仍在运行,我必须杀死它才能再次运行coffee。尴尬。
【问题讨论】:
标签: node.js vagrant text-processing node-inspector node-debugger