Noticed that if I run nodemon within intellij, I would not be able to debug any more inside intellij.
Not sure what reason it is. If just run the nodejs, no problem. However once I add the ‘/usr/local/bin/nodemon’ into the Node parameters of the run config, the breakpoint would not work.
To solve this problem, i have to use the Node.js remote debug.
1. add a debug port to the Node parameters
–debug=3001. Note It is double dash. this should be the same as the port in the following remote debug config.
in the intellij doc, another option is to use –debug-brk which would enable the debug to run from the start. I tried this param, it works if I just change some front end html/js, however it would not work when backend js changed. Might have other workaround if you have to debug some init processes.
2. add a new Node.js remote debug config in Intellij
Now you should be able to use run RUN to start the server.js application and use DEBUG to start the ‘remote server debug’ and then set break point in your node app. 🙂