我正在使用express.js作为Web框架,监听端口3000,开发一款基于node.js的应用程序。
我使用的是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"
}
]
}
我能够开始第一次的调试会话,但是在第二次及以后,我会得到错误 Error: listen EADDRINUSE: address already in use :::3000
这个错误是由于VSCode没有终止在第一次调试会话中创建的node.exe进程,所以在后续会话中,由于端口3000仍在使用中,node无法启动express服务器。
有谁可以帮助我配置VSCode,在停止调试器后终止node.exe进程?