As an alternative, we’ll consider using the built-in Node.js debugger keyword with watchers. In this article, we’ll explore two different debugging methods that prevent this problem, using the GUI and CLI, respectively. First, we’ll learn how to debug a Node.js app using Chrome’s built-in Developer Tools. Additionally, there are no breakpoints, meaning you have no way to track the values of the variables during runtime.Īs a workaround, you might use console.log statements, however, this could be problematic for large projects because you have to inspect many pages of logging statements: Debugging output The code above will produce the following output: console.log outputĪlthough this is a valid way to test, there are a few issues. For one, you can’t check the app’s memory usage tracking RAM usage is essential when it comes to optimizing performance. For example, consider the following JavaScript code: console.log("This code will be printed in the console") Typically, developers use console.log statements within their codebase to inspect issues. Not only does code testing ensure stability, but it also guarantees quality code and a better user experience. When developing software, debugging is one of the most important steps. How to debug Node.js using Chrome DevTools and watchersĮditor’s note: This article was last updated to include an example of debugging Node.js code with watchers in addition to using Chrome DevTools. Hussain Arif Follow Hussain is a CS student in Pakistan whose biggest interest is learning and teaching programming to make the world a better place.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |