Categories
JavaScript Answers

How to add a debug script to Node NPM?

Spread the love

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

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *