【发布时间】:2020-08-19 08:58:49
【问题描述】:
我已经尝试了许多在线可用的不同解决方案,但在我的情况下没有任何效果, 我正在尝试在运行时调试 nodeJS 应用程序,通过 UI/postman 调用 API
我的launch.json:从here获取指导
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"skipFiles": [
"<node_internals>/**"
]
}
启动本地服务器后,当我启动调试器时,它要求选择一个进程,我选择以--exec babel-node server.js 结尾的那个,它成功附加但不加载我的项目脚本,只有 node_modules、eval 和 node_internal。
在我的代码中,如果我设置断点,我会看到此错误“已设置断点但尚未绑定”
我的 package.json 启动脚本:
"scripts": {
"start": "nodemon --exec babel-node server.js"
}
我的代码在 ES6 中,我通过一个 shell 脚本启动服务器,该脚本首先设置一些环境,然后执行 npm start
我的.bablerc
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
【问题讨论】:
标签: node.js express debugging ecmascript-6 visual-studio-code