node.js - Loopback 4 Debugger nodemon 解决方案

标签 node.js debugging visual-studio-code loopbackjs nodemon

如何在 visual studio code 中使用 nodemon 调试 loopback 4/node 应用程序?

寻找一种在环回 typescript 代码更改时重建应用程序的解决方案。带有调试选项。

问候,

开尔文

最佳答案

我终于找到了调试 Loopback 4/node.js 的解决方案。如果有人有建议,请这样做,这是第一个真正满足我要求的解决方案。

通过运行启动调试器:

npm run debug

使用 nodemon 运行以下命令

nodemon --exec run debug

通过单击 Visual Studio 代码中行号的左侧来添加断点。

然后在 Visual Studio Code 中以 Debug模式启动应用程序

Visual Studio Code (top-bar) -> Debug -> Start Debugging

package.json

"debug": "npm run build && node --nolazy --inspect-brk=9229 .",
"build": "lb-tsc es2017 --outDir dist"

launch.json

{
 "version": "0.2.0",
 "configurations": [
{
  "type": "node",
  "request": "attach",
  "timeout": 1000000,
  "name": "Attach",
  "port": 9229,
  "restart": true
}
   ]
}

tsconfig.json

注意:这个文件默认通过环回扩展,所以你不必修改它。

 {
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "ES5",
    "lib": ["es2015"],
    "allowJs": true,
    "skipLibCheck": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "platforms"]
}

应用结构

application structure

关于node.js - Loopback 4 Debugger nodemon 解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53740604/

相关文章:

c++ - 有没有办法在加载 dll 时调试发布版本?

javascript - javascript 文件中的函数无法使用声明文件检测自己的类型

macos - 如何设置链接以从 OSX 上的终端打开 Visual Studio Code?

javascript - NodeJS Fork 无法杀死子进程

node.js - Sequelize : How to query a parent column by the sum of an associated table's column

node.js - 如何创建 Node js ssl 服务器?

c++ - 在运行时在共享库中调试/跟踪?

debugging - 如何调试 htaccess 重写脚本

php - 如何让 Dropdown 返回文本值而不是索引值

javascript - WebRTC dataChannel.readyState 在 "connecting"上停止