Home > Development Tools > VSCode > A brief analysis of the method of debugging Node.js in VSCode

A brief analysis of the method of debugging Node.js in VSCode

青灯夜游
Release: 2021-09-14 19:09:32
forward
2462 people have browsed it

How to debug Node in VSCode? The following article will introduce to you the method of debugging Node.js in VSCode. I hope it will be helpful to you!

A brief analysis of the method of debugging Node.js in VSCode

The simplest way to debug: Run Current File

Because VSCode has a built-in Node debugger, debugging Node is extremely simple, follow these steps. [Recommended learning: "vscode tutorial"]

Run Current File

  • Find the Run And Debug button in the ToolBar And click, or directly <Command Shift D> to open debugging

  • Select Run Current File

    # in the debug panel
  • ##Click the small green debugging button to start debugging

Run Current File For debugging NodeJS, it is just a click. How to debug Typescript and more complex large projects?

Debug Project: JavaScript Debug Terminal

If there is a

ts file that needs to be debugged, how should it be handled?

Javascript Debug Terminal

  • #

    Open Terminal

  • at
  • Terminal

    Click the small button on the right side of the panel, and continue to click Javascript Debug Terminal to open the JS debugable terminal

  • Enter the command to execute the ts file:
  • npx ts-node index.ts

  • If starting the project is particularly complicated, how to deal with it?

The following is an example (although it is not particularly complicated), abstracting the startup command as

npm start

. <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;toolbar:false;">{ &quot;scripts&quot;: { &quot;start&quot;: &quot;NODE_ENV=production node index.js&quot; } }</pre><div class="contentsignin">Copy after login</div></div>The second step, enter the command in the debuggable terminal

npm start

The third step, start debugging

More programming related knowledge, Please visit:

Introduction to Programming

! !

The above is the detailed content of A brief analysis of the method of debugging Node.js in VSCode. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:juejin.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template