Nestjs 项目使用 vscode debug 配置

495 阅读1分钟

该方法也适用于其他 nodejs 项目的 debug

使用 vscode 打开 nodejs 项目,

1点击 create a launch.json file

image.png

  1. 删除 Configurations 数组里面全部的默认配置

image.png

3 点击 add configuration

image.png

4 选择 Node.js: Launch via npm

image.png

  1. 添加如下 两行配置
 "runtimeVersion": "18.14.2",
 "internalConsoleOptions": "neverOpen",
 

image.png

6 修改 debug 为 start:debug

start:debug 为 当前项目的 package.json 里面启动 debug 调试的配置的 scripts

image.png

image.png