gpt4 book ai didi

node.js - 无法在 Visual Studio 代码中调试 Nodejs 应用程序

转载 作者:太空宇宙 更新时间:2023-11-04 01:53:27 25 4
gpt4 key购买 nike

我使用 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-node index.js”,

“开始”:“每个环境”,

“开始:开发”:“nodemon --exec babel-node index.js”,

最佳答案

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

1.) 按照 Mickers 在上述评论中建议的步骤进行操作

2.)(针对异步模块问题)rm -rf node_modules

后跟 -- npm install

调试器已成功附加

关于node.js - 无法在 Visual Studio 代码中调试 Nodejs 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48829886/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com