Reads:44450Replies:1
Debug Node.js programs using node-inspector in Chrome
Node.js development is very speedy but not debugging-friendly. Apart from console.log, you can also install node-inspector to achieve step-through debugging in the Chrome browser.
Installation command: npm install -g node-inspector Notes: The installation of node-inspector may take a long time. My first try installing it failed because of the unstable network. You can first try npm install -g cnpm to install the domestic npm command provided by Taobao, and then run the cnpm install -g node-inspector command to install it from foreign servers. After successful installation, enter node-inspector in the command line to start the tool. ![]() Then run a command line tool and start your application in debug mode, for example: node --debug app.js //Or npm --debug start //If you have installed nodemon: nodemon --debug ./bin/www Enter the URL http://127.0.0.1:8080/?port=5858 provided by node-inspector, and you will be able to debug your program. |
|
1st Reply#
Posted time:Dec 12, 2016 7:51 AM
The built in Node V8 Inspector is a very speedy option. That along with this Chrome extension NIM https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj makes things super easy. You won't need to copy/paste the Inspector URL.
|
|