How to Debug Node.js Code with Visual Studio

2016/01/312 min read
bookmark this
Responsive image

Table of Contents

  1. Introduction
  2. Install Node.js Tools for Visual Studio
  3. Debug Your Node.js App
  4. Conclusion

Introduction

Scott already wrote a blog in 2013 about the Node.js tools for Visual Studio, so for more detailed information you can find it at Introducing Node.js Tools for Visual Studio. This blog shows how to run debugging in practice.

Install Node.js Tools for Visual Studio

First, you need to install Node.js tools for your Visual Studio. Go to the following page to download it, and this assumes you already have Node.js and Visual Studio installed.

NodejsTools For Visual Studio

Debug Your Node.js App

Open your Node.js project and click the browser button (in the following example, click Google Chrome).

Node.js tools will use node.exe to open another port to start debugging your Node.js app.

There you go, you are done. You can use Visual Studio's debug tools now.

Conclusion

Debugging Node.js in Visual Studio is simple: install the Node.js Tools extension, open your project, and launch it with a browser. For more information about Node.js debugging in Visual Studio, please reference the following:

  • Advanced Debugging

  • nodejstools download