Yaron Idan Yaron Idan - 28 days ago 12
Node.js Question

Remote debug nodejs using intellij

I'm trying to remote debug my nodejs application (which is actually running on a docker container in my local machine but for all purposes is treated as a remote host)

I've ran the app with nodemon using the following command in my docker-compose file

nodemon --debug=3010 app.js


Then opened the port for the container and used port-forwarding for the port to be available in localhost:3010.

Later I've setup the following configuration in intellij remote debugger plugin:

host: localhost
port: 3010


Now, when running the code in the container, the code doesn't stop on my breakpoint. I'm pretty sure I should launch the configuration I've set up for remote debugging, but don't really see how.

I've also tried setting the host parameter of the remote debugging plugin to the docker-machine ip, but this also gave no result.

What should I do to make intellij stop when the code reaches my breakpoint?

Answer

In order to launch the configuration I had to go to run -> debug and then choose edit configuration. In the configuration window I've added a new configuration of the "Node.js Remote Debug" type, and then pressed the debug button at the bottom of the screen. Hope this helps future wanderers.