opensanca / trilha-javascript

Aprenda JavaScript com o material, exercícios disponibilizado aqui no repositório!
http://www.opensanca.com.br
MIT License
119 stars 38 forks source link

Debug Node com Chrome Developer Tools #6

Open cristofersousa opened 8 years ago

cristofersousa commented 8 years ago

Debugging Node.js with Chrome DevTools

by Paul Irish

New support for Node.js debuggability landed in Node.js master in May. You can see it in action in the DevTools Google I/O talk. Or you can try it out yourself, right now. Let’s go…

Here’s how to get up and running:

* 1. Download* and install the current version of node.**

2. A nightly build was previously required, but support is innode as of v6.3.0.

You can install manually, use nvm to install the latest: nvm install node,\ or even use **node-nightly** to get a fresh nightly build.

3. Run it with the --inspect flag

node --inspect index.js

You can also break on the first statement of the script with --debug-brk.

node --inspect --debug-brk index.js

4. Open the provided URL You’ll get a url starting with “chrome-devtools://..” to copy/paste into Chrome. After dropping it in, you’ll have all the Chrome DevTools features you’re used to:

Enjoy.

More info