Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 308 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I debug Node.js applications?

#1
How do I debug a Node.js server application?

Right now I'm mostly using *alert debugging* with print statements like this:

sys.puts(sys.inspect(someVariable));

There must be a better way to debug. I know that [Google Chrome][1] has a command-line debugger. Is this debugger available for Node.js as well?

[1]:

[To see links please register here]

Reply

#2
Node.js version 0.3.4+ has built-in debugging support.

`node debug script.js`

Manual:

[To see links please register here]

Reply

#3
[Theseus](

[To see links please register here]

) is a project by Adobe research which lets you debug your Node.js code in their Open Source editor [Brackets](

[To see links please register here]

). It has some interesting features like real-time code coverage, retroactive inspection, asynchronous call tree.


![screenshot][1]


[1]:
Reply

#4
node-debug -p 8888 scriptFileName.js

Reply

#5
If you need a powerful logging library for Node.js, [Tracer

[To see links please register here]

is a better choice.

It outputs log messages with a timestamp, file name, method name, line number, path or call stack, support color console, and support database, file, stream transport easily. I am the author.
Reply

#6
I personally use [JetBrains WebStorm](

[To see links please register here]

) as it's the only JavaScript IDE that I've found which is great for both frontend and backend JavaScript.

It works on multiple OS's and has Node.js debugging built-in (as well as a ton of other stuff](

[To see links please register here]

).

My only 'issues'/wishlist items <del>are</del> **were**:

1. <del>It seems to be more resource hungry on Mac than Windows</del> It no longer seems an issue in version 6.
2. <del>It would be nice if it had Snippet support (like those of [Sublime Text 2]() - i.e. type 'fun' and tap 'tab' to put in a function.</del> See @WickyNilliams comment below - With Live Templates you also have snippet support.

Reply

#7
Assuming you have node-inspector installed on your computer (if not, just type 'npm install -g node-inspector') you just have to run:

node-inspector & node --debug-brk scriptFileName.js

And paste the URI from the command line into a WebKit (Chrome / Safari) browser.
Reply

#8
[Node.js Tools for Visual Studio][1] 2012 or 2013 includes a debugger. The overview [here][2] states "Node.js Tools for Visual Studio includes complete support for debugging node apps.". Being new to Node.js, but having a background in .NET, I've found this add in to be a great way to debug Node.js applications.

[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#9
[IntelliJ][1] works wonderfully for Node.js.

In addition, IntelliJ supports 'Code Assistance' well.


[1]:

[To see links please register here]

Reply

#10
Just for completeness:

The [PyCharm 3.0 + Node.js Plugin offers an awesome development + run + debug experience][1].

[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through