How can I debug node modules?

I am looking into getting involved with the rather exciting node.js, but I’m trying to find ways to replace my current development environment.

At present, my best friend in PHPLand is FirePHP module for Firebug, which is a god send as far as debugging your PHP goes. What methods do I have at my disposal for debugging node code? Does it output errors and warnings like PHP can be set to?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

There are multiple ways to debug node.

Personally I use a lot of well place console.log, console.dir and util.inspect statements throughout my code and follow the logic that way.

Of course unit tests come hand in hand with debugging. Write tests that assert your code work. The unit tests will cover catching most of the bugs.

You must write unit tests for your node.js code. nodeunit is great for general testing.

If your using express as your web engine then use expresso

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply