I\'d like to debug node.js like rails. I\'ve tried several ways:
To answer your question: There is no way. Unfortunately, with Node.js, you always have to restart the debugging session when you change your code
For configuration you need to have the Webstorm 2018.2 and follow the steps below:
and ALSO include the option to "Attach to Node.js/Chrome" [+] as follow:
To make the debugger restart after every change you would have to enable the [x] Reconnect Automatically option.
The flow of working with the debug is:
Note: If you are going direct to the debugger instead (and therefore not following this process) one would probably be expecting a termination of the process after changing the code lines.
I am not sure how byebug
works. However if you use VSCode and nodemon (installed globally), VSCode can reattach itself to the running process and will break at the same point in the debugger.
Here is what my config file looks like
{
"name": "Launch server.js via nodemon",
"type": "node",
"request": "launch",
"runtimeExecutable": "nodemon",
"program": "${workspaceFolder}/joiValidation.js",
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
Here is the small video I made from my debugging. Official documentation