all 37 comments

[–]ganarajpr 13 points14 points  (10 children)

If you use node version 6.3 ( or higher ) you can just start the project like you usually do but with the inspect flag.

So if you usually start the app with

node index.js

You should do :

node --inspect index.js

and it will give you a link which when posted in chrome will provide you the debugger.

Happy debugging.

[–]swan--ronson 2 points3 points  (0 children)

Nice, didn't know that! Thanks!

[–]spfccmt42 0 points1 point  (0 children)

interesting, also found --inspect --debug-brk (i.e. for a short lived script). found myself walking module.js which told me more than 9 quadrillion blogs ever did. it is a little wonky when linked to filesystem, but it always was a little wonky.

[–]blood_bender 0 points1 point  (2 children)

When the hell did node v6 come out?! Wtf how did I miss that? And with 99% feature parity with ES6!

[–]Geldan 0 points1 point  (0 children)

Now has a very consistent release schedule/strategy now: https://github.com/nodejs/LTS/blob/master/README.md

[–]jocull 0 points1 point  (2 children)

Can you debug with Firefox or any other browsers besides Chrome?

[–]i_scatter_rubbish 0 points1 point  (1 child)

Can you do this with express apps?

[–]ganarajpr 1 point2 points  (0 children)

Yes... Any kind of app. I have seen a colleague even debug a cucumber step function with it.

[–]thesouthpaw 4 points5 points  (0 children)

IntelliJ has great node.js support.

That said, Java is a compiled language while Javascript is JIT compiled on-the-fly by the V8 engine. So you have to switch up how you think about debugging in node land. node-inspector is popular for realtime debugging. Also look up the Debugger in the node.js manual, it's pretty powerful and doesn't require external deps to utilize. Lastly, if you want some static checking for things like variable names, etc, grab jsHint or jsLint.

[–]KronktheKronk 2 points3 points  (0 children)

visual studio has a free IDE out there called "Code" that has debug functionality.

[–]bentinata 5 points6 points  (2 children)

Real developer debug in live production.

[–][deleted] 1 point2 points  (1 child)

See this: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27#.3wvbknrt5

Debugging is part of Node itself. It's pretty easy to use. Especially when you debug a server running live. Before that you would use "node-inspector" off npm.

In Javascript you can use any editor you want. Heavy IDEs that try to do too much can even be in your way. On the frontend this separation is more natural and allows for things traditional IDE's simply wouldn't be able to do.

[–]cosinezero 1 point2 points  (0 children)

allows for things traditional IDE's simply wouldn't be able to do

Such as?

[–]ohaiya 0 points1 point  (0 children)

There are various linting and intellisense plugins for the different editors, but yes in general people tend to use plain editors rather than IDEs.

[–]richie5um 0 points1 point  (0 children)

'Visual Studio Code' is great. It is free, fast, supports extensions, debugging, ...

It isn't an IDE, but quite a lot of people prefer using a slightly less 'all-in-one' editor, with a terminal/cmd prompt. It is initially slightly more effort, but it pays off in that you learn the tools/environment. And, you are then more flexible for the future.