Node.js Debugging flow

后端 未结 3 426
后悔当初
后悔当初 2020-12-20 00:18

I\'d like to debug node.js like rails. I\'ve tried several ways:

  1. Webstorm debug – in this case I need to click \"rerun debug\" each time after code changed
3条回答
  •  囚心锁ツ
    2020-12-20 01:16

    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

提交回复
热议问题