node-inspector is the de-facto standard Node.js debugger, but runs in another browser window. For those that like their IDEs fully integrated, PhpStorm should support remote debugging functionality for Node.js but is currently buggy - it will only connect to servers on the same host. The bug is here.
For when the bug is fixed, here are RHEL/CentOS instructions on how to connect to a remote Node.js process (Node.js currrently only allows its debugger to listen for connections on 127.0.0.1
, which isn't much use for remote debugging).
On VM console 1 (-df
debug mode on for diagnosis):
yum install balance -yt balance -df 8585 127.0.0.1.5858
On VM console 2:
node --debug app.js
On host:
telnet {VM IP} 8585
Should output
Type: connect V8-Version: 3.6.6.14 Protocol-Version: 1 Embedding-Host: node v0.6.6 Content-Length: 0
VM console 1:
$ balance -df 8585 127.0.0.1:5858 argv[0]=balance bindhost=NULL source port 8585 file /var/run/balance/balance.8585.0.0.0.0 already exists the following channels are active: 0 0 127.0.0.1:5858:0 connect from 172.27.4.11 trying group 0 channel 0 ... connect to channel 0 successful connect from 172.27.4.11 trying group 0 channel 0 ... connect to channel 0 successful
The connection is working, so attach the remote debugger in PhpStorm (this is the step that's currently broken):
Host: | 172.27.8.04 (replace with VM's IP) |
Debug Port: | 8585 |
Debug on!