Skip to content

Instantly share code, notes, and snippets.

@scbedd
Created May 9, 2023 21:57
Show Gist options
  • Save scbedd/31060e575ef7fe5d6158d855117f4739 to your computer and use it in GitHub Desktop.
Save scbedd/31060e575ef7fe5d6158d855117f4739 to your computer and use it in GitHub Desktop.
Debug a node package

Basic guide to debugging with node

  • Place a debugger statement in the appropriate place within your typescript code. Say, generate_report.ts
  • Install Chrome, then open the URL chrome://inspect/ using it.
  • Click Open dedicated DevTools for Node
    • This will enable listening on the node debugging port.
  • Add --inspect to the node invocation of your actual code. EG: node --inspect ./dist/generate_report.js
    • This is extremely useful for diving into object mappings during template expansion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment