Hyperledger Fabric: How to debug balance-transfer typescript app in VS Code?

How to debug typescript app in VS Code?

  1. In VS Code goto Debug -> Add Configuration… and add following configuration to launch.json
    Screen Shot 2018-11-29 at 3.48.00 PM

2. cd to the directory where app.ts is located and from there run

$ /usr/local/bin/node --nolazy -r ts-node/register --inspect-brk=49528 app.ts

It should display a message

Debugger listening on ...

3. In VS Code go to View -> Debug and click on green button to launch Attach

4. The terminal should now display a message saying

Debugger Attached.

5. The debugger is attached now but the execution is paused. In VS Code click on the button to continue the execution (or press F5)

Screen Shot 2018-11-29 at 5.08.28 PM

6. That’s it you should be able to debug now

Screen Shot 2018-11-29 at 3.46.52 PM

Make sure the loaded scripts window shows your code.

Screen Shot 2018-11-29 at 3.48.54 PM

In debug console you should be able to debug variables

Screen Shot 2018-11-29 at 3.56.49 PM

This entry was posted in Software. Bookmark the permalink.

Leave a comment