Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative debug output for node/vscode, while building a terminal based visualization

i'm developing a terminal based app with Node, and i'm using the terminal as output of a Blessed.js visualization. So, i can't use the terminal to console.log thing for debug. Does node offer an alternative debug output? I'm using VSCode.

Thanks!

like image 328
piLeoni Avatar asked Oct 31 '25 23:10

piLeoni


1 Answers

In package.json add in scripts section:

 "scripts": {
    "debug": "node --nolazy --inspect-brk=9229 main.js"
  },

In vscode launch.json add:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9229
        }
    ]
}

Now:

First run blessed app with npm run debug

In 2nd step run vscode debugger with F5

You will see both blessed app interface and debugger in vscode.

Works for me ;)

like image 112
Bartek Avatar answered Nov 02 '25 13:11

Bartek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!