{"id":10780,"date":"2023-06-09T11:32:07","date_gmt":"2023-06-09T11:32:07","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=10780"},"modified":"2026-02-26T14:02:43","modified_gmt":"2026-02-26T14:02:43","slug":"how-to-debug-node-js-applications","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/","title":{"rendered":"How To Debug Node.js Applications"},"content":{"rendered":"<p><strong><\/strong><\/p>\r\n<p>In this article, we will explain the steps to debug your Node.js applications with the help of debug module, the built-in Node debugger, and Chrome\u2019s developer tools.<\/p>\r\n\r\n\r\n\r\n<p>Node.js is a server-side javascript technology and it is very reliable, asynchronous, and event-driven. Moreover, you can locate the code issues with the help of Chrome Dev Tools.<\/p>\r\n\r\n\r\n\r\n<p>Debugging the Node.js Application:<\/p>\r\n\r\n\r\n\r\n<p>One of the best methods to spot problems in Node.js applications is the extra usage of console.log debugging.<\/p>\r\n\r\n\r\n\r\n<p>Now, Check them below:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>The debug module<\/code><\/pre>\r\n\r\n\r\n\r\n<p>One of the most popular modules that are required in your project comes with a debug module. You can use this module, and you can enable the third part of the module, to log into the standard output, stdout.<\/p>\r\n\r\n\r\n\r\n<p>To verify, whether a module is using it, double-check the package.json file&#8217;s dependency section.<\/p>\r\n\r\n\r\n\r\n<p>For using the debug module, first of all, you need to set the DEBUG environment variable while you are starting with applications. You can also use the character wildcard names.<\/p>\r\n\r\n\r\n\r\n<p>The below line will print all the express-related logs to the standard output.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>DEBUG=express* node app.js<\/code><\/pre>\r\n\r\n\r\n\r\n<p>Check out the output given below:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>Built-in Node.js Debugger<\/code><\/pre>\r\n\r\n\r\n\r\n<p>Talking about Node.js it includes a full-featured debugging utility that can be easy to access through a TCP-based protocol and a built-in debugging client.<\/p>\r\n\r\n\r\n\r\n<p>To start the built-in debugger, you have to start the application, you have to execute the command given below:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>node debug app.js<\/code><\/pre>\r\n\r\n\r\n\r\n<p>After this, you have entered this, and you will get the output, as given below:<\/p>\r\n\r\n\r\n\r\n<p>Descriptions of the Node.js Debugger:<\/p>\r\n\r\n\r\n\r\n<p>c = Continue to execute the code<\/p>\r\n\r\n\r\n\r\n<p>n=execute this line and go to the next line<\/p>\r\n\r\n\r\n\r\n<p>s= step into this function<\/p>\r\n\r\n\r\n\r\n<p>o=finish function execution and step out<\/p>\r\n\r\n\r\n\r\n<p>repl=allows code to be evaluated remotely<\/p>\r\n\r\n\r\n\r\n<p>Choose any bodHOST&#8217;s Nodejs Hosting Server with Ultimate Power, Speed, and one of the best Security!<\/p>\r\n\r\n\r\n\r\n<p>If you want to add breakpoints to the application by inserting the debugger statement into your codebase.<\/p>\r\n\r\n\r\n\r\n<p><em>function add (a, b) {<\/em><\/p>\r\n\r\n\r\n\r\n<p><em>\u00a0 debugger<\/em><\/p>\r\n\r\n\r\n\r\n<p><em>\u00a0 return a + b<\/em><\/p>\r\n\r\n\r\n\r\n<p><em>}<\/em><\/p>\r\n\r\n\r\n\r\n<p><em>var res = add(\u2018abc\u2019, 3)<\/em><\/p>\r\n\r\n\r\n\r\n<p>The Watchers<\/p>\r\n\r\n\r\n\r\n<p>Watch the expressions and different variables during the process of debugging. Every expression from the watcher&#8217;s list will be evaluated in the current context on each breakpoint and shown just before the source code listing for the breakpoints.<\/p>\r\n\r\n\r\n\r\n<p>If you want to use the watchers, then you need to define them for the expressions you want to watch. Follow these steps to put this into action:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>watch (\u2018expression\u2019)<\/code><\/pre>\r\n\r\n\r\n\r\n<p>The Chrome Debugger<\/p>\r\n\r\n\r\n\r\n<p>When you debug complex applications, visuals can help. You can use the familiar UI of the Chrome DevTools for debugging the Node.js applications.<\/p>\r\n\r\n\r\n\r\n<p>The best part of the Chrome Debug protocol has been ported into the Node.js module and it can be ideally used for the debugging of the Node.js applications. For this, you need to install the node inspector:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>npm install -g node-inspector<\/code><\/pre>\r\n\r\n\r\n\r\n<p>Start the debugging your applications by doing it in the following way:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>node-debug index.js \u2013debug-brk<\/code><\/pre>\r\n\r\n\r\n\r\n<p>You may start debugging your Node.js applications with it, and it will expand the Chrome Developer tools.<\/p>\r\n\r\n\r\n\r\n<p>Conclusion<\/p>\r\n\r\n\r\n\r\n<p>In this way, we have seen how to debug a remote application using Chrome DevTools. With the help of watch variables and breakpoints, you can simply follow errors without publishing to the console and see how the variables change.<\/p>\r\n<p><strong><\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>In this article, we will explain the steps to debug your Node.js applications with the help of debug module, the built-in Node debugger, and Chrome\u2019s developer tools. Node.js is a&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[666],"tags":[1456],"class_list":["post-10780","post","type-post","status-publish","format-standard","hentry","category-general","tag-debug-node-js-applications"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Debug Node.js Applications<\/title>\n<meta name=\"description\" content=\"Learn how to debug Node.js applications effectively with step-by-step guidance. Discover tools, techniques, and best practices for smooth troubleshooting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Debug Node.js Applications\" \/>\n<meta property=\"og:description\" content=\"Learn how to debug Node.js applications effectively with step-by-step guidance. Discover tools, techniques, and best practices for smooth troubleshooting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-09T11:32:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:43+00:00\" \/>\n<meta name=\"author\" content=\"Vincer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vincer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/\"},\"author\":{\"name\":\"Vincer\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/f3852d74aeac480763235276b5faddd0\"},\"headline\":\"How To Debug Node.js Applications\",\"datePublished\":\"2023-06-09T11:32:07+00:00\",\"dateModified\":\"2026-02-26T14:02:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/\"},\"wordCount\":548,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"Debug Node.js Applications\"],\"articleSection\":[\"General Discussion\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/\",\"name\":\"How To Debug Node.js Applications\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2023-06-09T11:32:07+00:00\",\"dateModified\":\"2026-02-26T14:02:43+00:00\",\"description\":\"Learn how to debug Node.js applications effectively with step-by-step guidance. Discover tools, techniques, and best practices for smooth troubleshooting.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-debug-node-js-applications\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"General Discussion\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/general\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Debug Node.js Applications\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/f3852d74aeac480763235276b5faddd0\",\"name\":\"Vincer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g\",\"caption\":\"Vincer\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/vinayak\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Debug Node.js Applications","description":"Learn how to debug Node.js applications effectively with step-by-step guidance. Discover tools, techniques, and best practices for smooth troubleshooting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/","og_locale":"en_US","og_type":"article","og_title":"How To Debug Node.js Applications","og_description":"Learn how to debug Node.js applications effectively with step-by-step guidance. Discover tools, techniques, and best practices for smooth troubleshooting.","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2023-06-09T11:32:07+00:00","article_modified_time":"2026-02-26T14:02:43+00:00","author":"Vincer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vincer","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/"},"author":{"name":"Vincer","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/f3852d74aeac480763235276b5faddd0"},"headline":"How To Debug Node.js Applications","datePublished":"2023-06-09T11:32:07+00:00","dateModified":"2026-02-26T14:02:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/"},"wordCount":548,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["Debug Node.js Applications"],"articleSection":["General Discussion"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/","name":"How To Debug Node.js Applications","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2023-06-09T11:32:07+00:00","dateModified":"2026-02-26T14:02:43+00:00","description":"Learn how to debug Node.js applications effectively with step-by-step guidance. Discover tools, techniques, and best practices for smooth troubleshooting.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"General Discussion","item":"https:\/\/www.bodhost.com\/kb\/category\/general\/"},{"@type":"ListItem","position":2,"name":"How To Debug Node.js Applications"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/f3852d74aeac480763235276b5faddd0","name":"Vincer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g","caption":"Vincer"},"url":"https:\/\/www.bodhost.com\/kb\/author\/vinayak\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/10780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=10780"}],"version-history":[{"count":5,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/10780\/revisions"}],"predecessor-version":[{"id":11500,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/10780\/revisions\/11500"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=10780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=10780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=10780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}