How to debug a nodemon project in VSCode

Change package.json to

"scripts": {
    "dev": "node app.js",
    "debug": "nodemon --inspect app.js"
}

–inspect is for versions >= 6.3. –legacy or –auto for older versions

And launch.json to:

"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "attach",
        "name": "Node: Nodemon",
        "processId": "${command:PickProcess}",
        "restart": true,
        "protocol": "inspector"
    }
]

the restart flag is the key here.

Start app via new debug script

npm run debug

  • In Debug view, select the Node: Nodemon configuration and press play
    or F5
  • Choose the process started above

See more: vscode nodemon recipe

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)