How to speed up debugging of Node.js applications? The following article will take you through how to use DevTools to speed up debugging Node.js applications. I hope it will be helpful to you!
When doing some Node related development, we often use Console to change the contents of variables Output to the console for viewing. It is still possible to view simple data, but when we encounter relatively large objects and many mounted attribute functions, the console may not be displayed, or even the content may be washed away. Seriously hindering our development efficiency, today we will use node-nightly to allow us to conveniently debug in Chrome and view our objects and Output log.
[Recommended learning: "nodejs Tutorial"]
Let’s take a look at the effect through a simple demonstration plug-in of webpack
Install node-nightly: npm install --global node-nightly
.
##Execute node-nightly: node-nightly.
node-nightly :node-nightly --inspect-brk ./node_modules/webpack/bin/webpack.js, the script will break at the first statement and wait for operation.
chrome://inspectOpen
Chrome Inspect.
project in source, In the future, we can proceed as we originally did when debugging JavaScript in chrome.
##The information in the Console is also printed out
Supplementary instructions
--config webpack.prod.js.
If
node-nightly --version {version}or Install the latest arrangement: node-nightly --upgrade Try to fix the problem
The above is the detailed content of How to use Node.js+DevTools to quickly debug applications?. For more information, please follow other related articles on the PHP Chinese website!