Remote nodejs debugging not connecting
Hi there,
I'm considering purchasing a PHPStorm licence but there is one thing holding me off, and that is I can't get the remote debugging feature to work.
In my setup I have a Windows laptop that I work on, and a home linux server. The app runs on the IP 192.168.1.83, while my laptop is .81.
I start up my node app with node --debug run, and it starts with the debugger running on 5858. I don't have any IPTable rules blocking and I can easily access my app running on port 8079 in the browser. I am also able to run node-inspector on the same machine and visit it on port 8080 which works fine.
But the PHPStorm instance on my windows machine will not connect to the debugger running on .83.
Any ideas?
Please sign in to leave a comment.
It seems that the node debugger listens on 127.0.0.1 address so it doesn't accept connections from remote computers. You can start a proxy on the linux server to redirect traffic from an externally accessible IP to 127.0.0.1 (e.g. using simpleproxy command). However after that another problem will arise. In your case paths to *.js files on the working machine and paths on the server are different and Remote NodeJS configuration currently doesn't allow to setup mappings between local and remote files so debugging won't work properly. Feel free to create an issue in our tracker (http://youtrack.jetbrains.net/issues/WI) about this.
As I couldn't find one, I've logged a bug for this here: http://youtrack.jetbrains.net/issue/WI-9821
I'm a little confused - is this fixed?
Does one have to use a proxy, still? Any notes on this on the JetBrains website or in the help system. It's very frustrating!
I ran into this problem too. I was using Windows 8 (with IntelliJ) and running Linux in a VM (via VirtualBox) and Docker. Remote debugger would work with the Node at the OS level, but not with the VM.
Yes a proxy is necessary where node is running, as it has to route that internal traffic outside which can be done by a couple tools, socat is the one that worked for us after trying a couple. There is nothing IntelliJ can do by itself, as it can't reach in linux without sys-admin type commands, it can only talk to the port that is expected.
http://www.dest-unreach.org/socat/ or apt-get install socat
Before you start node you have to start socat like
socat TCP-LISTEN:5858,fork TCP:localhost:6000 assuming you are running node debugger on port 6000
then
node --debug=6000 yourfile.js
if you are using docker in a vm you'll also need to forward the ports too e.g. -p 5858:5858