I have edited my package.json to customize the "start" script so it adds the --debug flag to node:

  "scripts": {
    "start": "node --debug server.js"
  }

Is there a way of adding new scripts for example a debug script that would do what my customized "start" is doing right now?

I'm looking to be able to execute:

npm debug

VS Code adds a <kbd>debug</kbd> button inline in the package.json file

  1. Open package.json and click debug above scripts section

    code npm package debug

  2. Select script to debug

    code npm package debug options

  3. Debugger should be attached

    code debugger