I would like to debug my sails.js application but I don't know how to launch node-inspector
for this occasion.
Normally it would go :
$ node --debug myapp.js
If I run my sails application normally :
$ sails lift --prod
and then launch 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.
I get this error in inspector GUI :
Error: read ECONNRESET. Check there is no other debugger client attached to port 1337.
I would like to debug my sails.js application but I don't know how to launch node-inspector
for this occasion.
Normally it would go :
$ node --debug myapp.js
If I run my sails application normally :
$ sails lift --prod
and then launch 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.
I get this error in inspector GUI :
Error: read ECONNRESET. Check there is no other debugger client attached to port 1337.
Share
Improve this question
asked Jan 26, 2014 at 14:23
PatrykPatryk
24.1k47 gold badges142 silver badges257 bronze badges
1
- possible duplicate of How to debug a basic node.js application (not http) on windows – Francisco Corrales Morales Commented Mar 29, 2015 at 22:03
2 Answers
Reset to default 11As of Sails 0.9.8 you can use sailsd
to call sails in debug mode, e.g. sailsd lift
.
-- Edit --
Looks like this didn't actually make it into 0.9.8, my bad. To make your own debugging command for now, save the following into /usr/local/bin
as sailsd
(or whatever you like):
#!/bin/sh
node --debug `which sails` $@
-- Edit 2 --
In Sails v0.10.x, you can do sails debug
instead of sails lift
to start Sails in debug mode!
Correct me if im wrong but, you cant use debug port 1337 if sails lifts on port 1337.
try specifying a different port.
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
edit just confirmed this method works, instead of using sails lift
you're using node to start app.js
in debug mode. the node-inspector web runs on port 8080
and the debugger links on port 5858
by default.