Sublime configuration Nodejs Run Debug JS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.