Node Js Debugger 地址已被使用

Node Js Debugger address already in use

我是学习 Node Js 的初学者,我正在尝试调试,但遇到此错误:

Waiting for the dError: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1300:14)
    at listenInCluster (net.js:1348:12)
    at Server.listen (net.js:1436:7)
    at Function.listen (c:\Users\Hp\Desktop\Node\online-shop\node_modules\express\lib\application.js:618:24)
    at Object.<anonymous> (c:\Users\Hp\Desktop\Node\online-shop\app.js:26:5)
    at Module._compile (internal/modules/cjs/loader.js:953:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
 at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1327:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
ebugger to disconnect...

我已经尝试了 PORT 3001 和其他端口,但我仍然遇到同样的错误

这是我的 launch.json 文件:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}\app.js"
    }
  ]
}

这是我的 app.js 文件

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`server started on port ${PORT}`));

使用 npm startyarn start 停止 运行 应用程序,然后再次尝试调试。您不能 运行 同时应用和调试。 Node Debugger 会将应用程序 运行 放入您指定的端口。