piLeoni
piLeoni

Reputation: 151

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!

Upvotes: 4

Views: 296

Answers (1)

Bartek
Bartek

Reputation: 31

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 ;)

Upvotes: 3

Related Questions