Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 26, 2022 01:36 am GMT

You don't need VSCode to debug your Node.js app [Google Chrome V8 inspect and debugger breakpoint]

Hi, Devs!

When we look at Node.js documentation there's a interesting option do debug our code and is inspector context

Let'a create a piece of code and let's use a debugger word that means a breakpoint for our debug process.

//index.jsconsole.log('hello')setTimeout(() => {    debugger    console.log('After debugger breakpoint')}, 8000)debuggerconsole.log('Finished')

For debugger's uses we need to configure one port into an extension of chrome web browser, copy on your web address:

chrome://inspect/

Click on configure and add the localhost:9229 address:

Node.js Chrome V8 Inspector Debugger

We are going to use the command below to start the debugger:

node --inspect index.js

After run the previous command --inspect, in the next step we need to click on inspect button, below the remote target.

Debugger V8 Javascript

And will be open the DevTools:

DevTools Debugger Javascript

And you could use the next button on the right of the image above where is writing Debugger paused

You could add some expression on Watch to verify some value and into Scope verify the returns.

Contacts
Email: [email protected]
Instagram: https://www.instagram.com/luizcalaca
Linkedin: https://www.linkedin.com/in/luizcalaca/
Twitter: https://twitter.com/luizcalaca


Original Link: https://dev.to/luizcalaca/you-dont-need-vscode-to-debug-your-nodejs-app-google-chrome-v8-inspect-and-debugger-breakpoint-5dd8

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To