[英]How to debug Express js server code on Node using Visual Studio Code by Attaching to running process
[英]How to attach to express process using VS Code?
我正在使用gulp-nodemon運行Express API,並且想使用VS Code調試收到的請求。
我的問題是:我無法附加到正在運行的進程。 在我的launch.json
配置中,我不想開始附加,我只想附加到正在運行的實例(由gulp管理)。
我的VS Code launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 5858 // tried to use 3000 (express port), but failed too
}
]
}
使用端口3000,它將立即失敗而沒有顯示任何內容。 使用端口5858失敗並顯示以下消息:
無法連接到運行時進程(10000毫秒后超時)。
我使用以下命令在調試模式下運行應用程序:
node --inspect app
我的配置使用端口9229:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}
]
}
端口5858用作現在已棄用的--debug
選項的端口
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.