【发布时间】:2020-06-26 07:10:52
【问题描述】:
我正在开发一个 node.js 应用程序,使用 express.js 作为 Web 框架在 PORT 3000 上侦听。 我正在使用 VS Code v1.46。
我的 launch.json 文件是
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\WebApi\\index.js",
"restart": true,
"protocol": "inspector"
}
]
}
我第一次可以启动调试会话,但第二次以后,我收到错误 错误:监听 EADDRINUSE:地址已在使用 :::3000
此错误是因为 VSCode 没有终止在第一个调试会话中创建的 node.exe 进程,因此在随后的会话中,节点无法在端口 3000 上启动 express 服务器,因为它仍在使用中。
谁能帮我配置 VSCode 以在我停止调试器后终止 node.exe 进程?
【问题讨论】:
标签: node.js visual-studio-code vscode-debugger