News for hackers. Stuff that matters.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by paulirish on Sunday November 11, 2018 @09:05PM (#18430074)
The author linked to a post of mine for debugging Node with Chrome DevTools I agree that it's a little frustrating. But a few months ago, the `ndb` project launched with a phenomenally better user experience for this: https://github.com/GoogleChromeLabs/ndb

It has child processes support, easy Ctrl-R hotkey to restart your node, breakpoints can be placed anywhere, and nice default blackboxing of node internals. Worth a spin.

Re:The Absolute Easiest Way to Debug Node.js – With VS Code by emilsedgh on Sunday November 11, 2018 @10:56PM (#18430491)
Read the article and came back to mention `ndb`. Cannot emphasis how easy it is to debug with it.

If you're using node, do yourself a favor and `npx ndb` next time you wanna debug something.

Re:The Absolute Easiest Way to Debug Node.js – With VS Code by newsbinator on Sunday November 11, 2018 @10:40PM (#18430431)
'ndb' is so, so much better. You've just put something amazing in front of me. Thank you!!
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by devnill on Sunday November 11, 2018 @06:22PM (#18429361)
While VS Code is a great IDE, a lot of this article is simply untrue. Node has had an interactive debugger (and corresponding API) for years.

Prior to --inspect, --debugger gave developers the abilities to step through code and to jump into a REPL to examine and manipulate the application state. Beyond this, there were tools like node inspector(https://github.com/node-inspector/node-inspector) which provided a chrome inspector-like tool.

On top of that, these tools adhere to the chrome debugger API (https://chromedevtools.github.io/devtools-protocol/) which provides the ability to dump comprehensive data like the memory graph for those wishing to make profiling tools.

Re:The Absolute Easiest Way to Debug Node.js – With VS Code by chrisparton1991 on Sunday November 11, 2018 @08:44PM (#18429996)
> Unlike JavaScript in the browser, or Java with a powerful IDE like IntelliJ, you can’t just set breakpoints everywhere

I'm using IntelliJ to set breakpoints everywhere in a Node application at this very moment. It's super easy to set up, you just create a Node.js run configuration and hit the debug button.

Re:The Absolute Easiest Way to Debug Node.js – With VS Code by orf on Sunday November 11, 2018 @08:54PM (#18430033)
Same here, but with Python. The IntelliJ debugger is one of the absolute best features and I haven't found anything comparable yet.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by snackman7 on Monday November 12, 2018 @12:32PM (#18434035)
You can do this in VS Code as well. You create a launch.json file, and you can debug. A basic launch.json file is like 3 lines long, and VS Code makes it for you. There's no need for an extension. Maybe the author wasn't aware of that.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by np_tedious on Monday November 12, 2018 @08:43AM (#18432525)
How does this work with transpilation? Say I have typescript or a just different js than the end build, how does the debugger know which line to put the breakpoint on?

Does the run config need to be something more structured than "run this gulp command"?

Re:The Absolute Easiest Way to Debug Node.js – With VS Code by mikewhy on Monday November 12, 2018 @10:27AM (#18433136)
Pretty sure all you need is source maps.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by chrisparton1991 on Tuesday November 13, 2018 @06:39PM (#18445935)
Yep, source maps do the trick.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by np_tedious on Wednesday November 21, 2018 @09:14AM (#18502790)
late response, but i just got stop debugging for a typescript/node app set up in webstorm. far easier than i (and this article) had built it up to be. the sourcemap stuff was actually already taken care of, it was the addition of `$NODE_DEBUG_OPTION` to the `ts-node-dev` command that did the trick
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by Waterluvian on Sunday November 11, 2018 @06:14PM (#18429327)
ROS distributes robot concerns across dozens of nodes on a robot, possibly thousands of nodes in a fleet. Many of these are Python. It's been a joy using vscode to connect to a live running robot and the master server and remote debug a bunch of nodes at the same time.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by brian_herman on Sunday November 11, 2018 @08:00PM (#18429841)
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by keyle on Sunday November 11, 2018 @11:40PM (#18430626)
This is just highly biased. It's just as easy with IntelliJ and doesn't require any more fiddling around than this.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by tluyben2 on Sunday November 11, 2018 @10:42PM (#18430437)
Honest question: is there anyone here who uses Node that didn't figure this out themselves with VS Code or other editors in a few minutes? And then a lot of the info is (as already mentioned here as well) not true; this is nothing new nor special.
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by mlevental on Sunday November 11, 2018 @09:19PM (#18430149)
is there a way to debug promises in any of these debuggers? i.e. get a promise to resolve when stopped at a breakpoint?
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by giobox on Sunday November 11, 2018 @09:47PM (#18430243)
The “Smart Step” feature they added to the debugger a while back might be what you are looking for.

> https://code.visualstudio.com/updates/vApril#_smart-code-ste...

Re:The Absolute Easiest Way to Debug Node.js – With VS Code by mlevental on Monday November 12, 2018 @11:59AM (#18433787)
no this isn't it. i'm saying i want to be able to "run" a promise while stopped at breakpoint
Re:The Absolute Easiest Way to Debug Node.js – With VS Code by EGreg on Sunday November 11, 2018 @10:21PM (#18430359)
How do I make my code not trigger the debugger breakpoint whenever a promise fails? I get that the fail isn’t being handled but isn’t there to make a default handler in that case?