QWERTYCOD

Direct to solution!

Easiest way to debug a JavaScript or Node application in VS code

Published on:  


Steps:

1 Open your project in Visual Studio Code.

2 – Open the file which your want to debug, in this article we are using our Node API sample present on Github also to learn it. So open index.js file

3- Click on Run & Debug option on left panel then click on Javascript debug terminal as show below:

Now put breakpoints on lines of code which you want to debug, now run the Node project using command npm start

So after doing npm start, if you see the app is running now, we will then to the URL  http://localhost:8080/character?name=Tom

You should see the execution being stopped at our breakpoint as below:

So that’s how we debug the application.

 

While running the app you may face different issues, for example:

– How to know from where the error is coming

– Package.json file missing

– Not running the project from correct location/path

– Package/module not found.

We have discussed some most common issues and complete discussion on debugging any javaScript/Node app in this video as well.

More from Node/Javascript:

Natalie Harris
With references from Alan Plang
132
Kyle Aniston
With references from Alan Plang
75
Kyle Aniston
With references from StackOverflow
381
Mike Morgan
With references from StackOverflow
105
Mike Morgan
Forwared by QwertyBot
560
Mike Morgan
Forwared by QwertyBot
1.4k
Kyle Aniston
Forwared by Alan Plang
1.0k

Leave a Reply

Your email address will not be published. Required fields are marked *