$ npm install -g node-inspector
Run node in debug mode
$ node --debug your/node/program.js
Send USR1 signal to node
$ pkill -USR1 node
Launch node-inspector in background mode
$ node-inspector &
Open up the debugger in your browser by navigating to http://localhost:8080/debug?port=5858
If you have something like livereload restarting your node server when you change a source file, then re-launching node-inspector can be done with something like this:
$ PID=`ps -ef | grep node-inspector | grep -v grep | awk '{print $2}'`; if [[ $PID -ne '' ]]; then echo "Killing node-inspector (pid $PID)"; kill $PID; wait $PID; fi; echo "Sending USR1 signal to node"; pkill -USR1 node; echo "Launching node-inspector"; node-inspector&
No comments:
Post a Comment