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
Launch via npm: Launch a Node. js program through an npm 'debug' script. If you have defined an npm debug script in your package. json, you can use it directly from your launch configuration.
In your package.json define the script
"scripts": { "debug": "node --inspect server.js" }
And then you can use npm's run-script
npm run-script debug
or the shorter version
npm run debug
From the nodejs docs:
The legacy debugger has been deprecated as of Node 7.7.0. Please use --inspect and Inspector instead.
So starting from Node 7.7.0v use --inspect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With