Webstorm configuring node. JS Debugging

Source: Internet
Author: User
Tags install node

Recently, because of working relationships, I have been doing the development of node. js, learning the KOA Framework, ORM Framework Sequelize, and the configuration of swagger documents. However, because the swagger document uses a ES6 decorator (called Annotations in Java) recently, node. JS cannot compile the project, so you need to convert ES6 using Babel. Because this article is to write, how to configure the use of the Babel Converter debug method, as to how to configure Koa-swagger-decorator, I will shortly, write an article specifically to do this plugin introduction.

In fact, node in the 6 version of the time, has built-in debugger debugger, so in webstorm, only need to click here, configure the relevant node settings just fine. Specific participation in the following examples:

Then select the node. JS Configuration entry:

You can then configure the contents of the Configuration tab, for example:

Here's a brief explanation of what the top four items mean in the Configuration tab:

Node interpreter:这个参数是说使用什么启动程序,默认的是 `node`,
Node parameters:这个是对于node 的启动参数,
Working directory: 项目的路径,
JavaScript file: 入口文件

If there is no Babel, node. js running and debugging environment is already built, in Webstorm only need to click the Run and Debug buttons on the line. However, if the project with ES6, accidentally also use the Babel converter, then this method, it can not be used, then I will talk about the babel words, how to configure.

First, we install Node-inspect in the terminal, and it is installed as a global, the command is: NPM install-g node-inspect. After you open the page that configures the startup item, add a node. js Configuration again:

Note that the section specifically marked, the launcher does not use node, you need to change the project path under the \node_modules\.bin\babel-node.cmd option, and, in the startup parameters that block fill:--inspect-brk App.js, which means you need to use this thing to start debugging. After you have configured it, you can debug it directly in the Webstorm down breakpoint.

Webstorm configuring node. JS Debugging

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.