无法在Visual Studio代码中调试NodeJS应用程序



我使用expressjs应用程序的nodejs启动配置,调试器模式开始,然后立即停止..它不会继续听。任何帮助都非常感谢。

{
    "name": "Launch via NPM",
    "type": "node",
    "request": "launch",
    "cwd": "${workspaceFolder}/index.js",
    "runtimeExecutable": "npm",
    "runtimeArgs": [
        "run-script", "debug"
    ],
    "port": 9229
}

以下是我的服务器配置

app.listen(PORT, HOST, () => {
  process.stdout.write(Server is listening on ${PORT} (${NODE_ENV})n)
  log.info(Server is listening on ${PORT} (${NODE_ENV})n)
})

package.json

启动命令

" devstart":" nodemon -exec babel节点index.js",

" start":" per-env",

" start:development":" nodemon -exec babel节点index.js",

该问题通过以下步骤解决。

1。(按照上述评论中的Mickers建议的步骤

2。((对于异步模块问题(rm -rf node_modules

接下来-NPM安装

调试器已成功附加

最新更新