1

I am trying to add a debug script in my package.json file. For a plain Node project this code works:

"debug": "node --inspect index.js"

And for Node TypeScript project I did this:

"debug": "ts-node --inspect --require ts-node/register index.ts"

But this gives me error:

Error: Unknown or unexpected option: --inspect

What should I do?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

1 Answers1

1

Use the following command to pass the --inspect option directly to node as indicated in this ts-node issue.

node <node options here> --require ts-node/register

or

node <node options here> --loader ts-node/esm

So for your example, it would be

 "debug": "node --inspect --require ts-node/register index.ts"
Brian
  • 16,196
  • 3
  • 27
  • 28