Node.js Debugging flow

ε祈祈猫儿з 提交于 2019-11-29 12:42:28

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

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 😕.

I've recently written an article about debugging both JavaScript and TypeScript using different tools, if you're interested, but there's nothing like live debugging.

Now with the upgrade works just fine. [23/09/2018]

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:

  1. Run your (in my case) Nodemon.
  2. Debug your (in my case) NodemonDebugger
  3. Set the breakpoints and everything else and you are good to go.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!