Effective Debugging

Effective Debugging

Think of debugging as the process of finding an object in a dark and packed room.

The first thing you need to do is switch on the light because in the dark you can't find the object even if it's in front of you.

Enabling all the logs whenever possible will give you that light or else you are clueless on what is even happening.

Make sure you start running commands verbose e.g with -v options in many commands

Even after you switch on light the bug may be hidden below a table or inside a cupboard.

Here comes the skill of reading log files effectively. Sometimes the error may not be obvious. Some Google search or chat gpt may help here.

Hopefully, 60% of errors will be resolved by this time but today may not be that day.

It's time to go hard now, maybe try breaking objects in the room to find the bugs.

This can be done by inspecting of source code of the node module that shows the errors taking hints from the logs obtained from previous steps. If you find the bugs then you can fix them and release patches upstream effectively contributing to open source.

By this time you will be in a good position to understand why this error is happening but still wondering why that doesn't work. This is the time to report the issue to the maintainers of the package. It's also possible you are using the wrong version of the package.

Nothing works now?

It's time to seek help. While creating issues make sure you include all the above info so people helping have an idea of how you tried to find bugs in a dark and packed room.

Otherwise, if you tell them your error publicly they will wonder why you are not switching on the light.

Did you find this article valuable?

Support Ajeet Sinha by becoming a sponsor. Any amount is appreciated!