【问题标题】:Breakpoints not being hit when debugging Serverless in vscode在 vscode 中调试 Serverless 时没有命中断点
【发布时间】:2018-03-21 23:07:51
【问题描述】:

在 VSCode 中调试我的基于无服务器的应用程序时,我的断点均处于活动状态。

launch.json

{
  "configurations": [
    {
      "console": "integratedTerminal",
      "cwd": "${workspaceRoot}",
      "name": "Debug",
     "port": 5858,
      "request": "launch",
      "runtimeArgs": [
        "run-script",
        "vscode:debug"
      ],
      "runtimeExecutable": "npm",
      "type": "node"
    }
  ],
  "version": "0.2.0"
}

我的 package.json

...
"scripts": {
  ...      
  "vscode:debug": "export SLS_DEBUG=* && node --inspect=5858 --debug-brk --nolazy ./node_modules/.bin/serverless invoke local -s local -f customerAlexa -p ./test/requests/FindAgent-First-GoodZip.json"
},
....

当我从菜单中选择 Start Debugging 时,所有的红色断点都变灰,程序直接执行而不在断点处停止。

我在 Mac 上运行 Node 6.11.2、Serverless 1.23.0。谢谢大家。

【问题讨论】:

    标签: debugging visual-studio-code serverless-framework


    【解决方案1】:

    这是我的launch.json,它允许我使用断点。

    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceRoot}/node_modules/.bin/serverless",
      "args": [
        "offline",
        "start",
        "--skipCacheInvalidation"
      ],
      "env": {
        "NODE_ENV": "development"
      }
    }
    

    我正在使用 serverless-offline 在本地运行。我也在使用 webpack 和 babel。 skipCacheInvalidation 就是为了这个。

    我希望这会为您指明正确的方向。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-22
      • 1970-01-01
      • 1970-01-01
      • 2018-09-23
      • 2011-10-30
      相关资源
      最近更新 更多