To add a debug script to Node NPM, we run node with the --inspect option.
For instance, we write
{
"scripts": {
"debug": "node --inspect server.js"
}
}
to add the debug script into our package.json file.
We make it run node with the --inspect option to let us debug server.js.
Then we run it with
npm run debug