node. js Debug JavaScript configuration
1. First download the node. JS installation package to nodejs.org and install it.
2. Open the Sublime Text editor. Select Menu Tools--Build system--New build system ...
3. Save the file as Javascript.sublime-build
4. The file contents are:
{
"cmd": ["Node", "$file"],
"File_regex": "^[]*file \" (... *?) \ ", line ([0-9]*)",
"selector": "Source.javascript"
}
5. Restart Sublime Text Tick Menu Tools--Build System-to-JavaScript
6. You can use Ctrl + B to execute JavaScript programs.
The node. JS Debug web requires some plugins to be installed and configured. After you upgrade to 8, node. JS does not support installing the plugin node-inspector, which comes with
Inspect plugin. If you need to use the Node-inspector plugin, use the NVM switch to use NODEJS6. x version, and then install the plugin.
nvm install 6.1.0nvm use 6.1.0npm install -g node-inspector
1. Installing Node-inspector
NPM install-g Node-inspector
2. After the installation is complete, start the Inspector service:
Node-inspector &
3. Open in Chrome browser: http://127.0.0.1:8080/?port=5858
4. Open the JS file you want to debug, such as App.js, and break the breakpoint in the code: debugger; For example:
5.cmd into Project file app.js execution Entry file: node--debug app.js
6. Refresh the browser you just opened:
7. Test: I need to post This example, I am in the postman to tune This interface:
8. Open the browser to see the code has entered the Debuger, debugging skills and JS basic all the same, step by step execution can
9. After step execution, CMD will print the information of Console.log ().
The log information can also be seen in the browser:
Sublime configuration Nodejs Run Debug JS