npm start不起作用,但是调试有效

时间:2018-08-19 05:30:21

标签: javascript node.js

我试图通过在Visual Studio Code中通过控制台键入npm start来运行我的nodejs应用程序。

我在代码中指定的端口是port 3000,并且我检查了没有进程在使用端口3000。它返回

[Function: ex]
Listening on 3000
Port 3000 is already in use

但是,当我尝试通过Visual Studio Code运行调试时,它在Port 3000上运行良好。

如何解决此问题,以便可以与npm start一起运行?

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}/app.js"
        },
        {
            "type": "node",
            "request": "attach",
            "protocol": "inspector",
            "name": "Attach by Process ID",
            "processId": "${command:PickProcess}"
        },
        {
            "type": "node",
            "request": "attach",
            "protocol": "inspector",
            "name": "Attach",
            "port": 9229
        }
    ]
}

0 个答案:

没有答案