我想调试我的sails.js应用程序,但我不知道如何启动node-inspector。
通常情况下,它会:
$ node --debug myapp.js如果我正常运行我的帆应用程序:
$ sails lift --prod然后启动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.我在检查器GUI中得到了这个错误:
Error: read ECONNRESET. Check there is no other debugger client attached to port 1337.发布于 2014-01-26 17:32:45
如果我错了,请纠正我,但是,如果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编辑刚刚确认此方法有效,而不是使用sails lift,而是使用节点在调试模式下启动app.js。节点检查器web运行在端口8080上,而调试器链接默认在端口5858上。
发布于 2014-01-27 17:22:15
从Sails0.9.8开始,您可以使用sailsd在调试模式下调用Sails,例如sailsd lift。
-编辑--
看起来这没能变成0.9.8,我的错。要现在执行您自己的调试命令,请将以下内容保存到/usr/local/bin中作为sailsd (或您喜欢的任何东西):
#!/bin/sh
node --debug `which sails` $@-编辑2 --
在Sailsv0.10.x中,您可以使用sails debug而不是sails lift在调试模式下启动Sails!
https://stackoverflow.com/questions/21364537
复制相似问题