Pat*_*ryk 10 javascript debugging node.js sails.js
我想调试我的sails.js应用程序,但我不知道如何启动node-inspector这个场合.
通常它会:
$ node --debug myapp.js
Run Code Online (Sandbox Code Playgroud)
如果我正常运行我的风帆应用程序:
$ sails lift --prod
Run Code Online (Sandbox Code Playgroud)
然后发布 node-inspector
$ node-inspector --debug-port 1337
Node Inspector v0.7.0-2
info - socket.io started
Visit http://127.0.0.1:8080/debug?port=1337 to start debugging.
Run Code Online (Sandbox Code Playgroud)
我在检查器GUI中收到此错误:
Error: read ECONNRESET. Check there is no other debugger client attached to port 1337.
Run Code Online (Sandbox Code Playgroud)
sgr*_*454 11
从Sails 0.9.8开始,您可以使用sailsd调试方式调用sails,例如sailsd lift.
- 编辑 -
看起来这实际上没有进入0.9.8,我的不好.要立即制作自己的调试命令,请将以下内容保存/usr/local/bin为sailsd(或任何您喜欢的内容):
#!/bin/sh
node --debug `which sails` $@
Run Code Online (Sandbox Code Playgroud)
- 编辑2 -
在Sails v0.10.x中,您可以执行sails debug而不是sails lift在调试模式下启动Sails!
如果我错了,请纠正我,但如果风帆在1337端口上升,则无法使用调试端口1337.
尝试指定其他端口.
node --debug app.js
#this will lift sails on port 1337 and the default debug port i think its 5858
#start node-inspector, once it starts hit enter to put it into background
node-inspector &;
#visit http://127.0.0.1:8080/debug?port=5858
Run Code Online (Sandbox Code Playgroud)
编辑刚刚确认此方法有效,而不是使用sails lift您使用节点以app.js调试模式启动.node-inspector web在端口上运行,8080调试器5858默认在端口上链接.
| 归档时间: |
|
| 查看次数: |
4415 次 |
| 最近记录: |