gpt4 book ai didi

debugging - 在 vscode 中调试 Serverless 时未命中断点

转载 作者:行者123 更新时间:2023-12-02 23:53:58 24 4
gpt4 key购买 nike

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

启动.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"
},
....

当我从菜单中选择“开始调试”时,所有红色断点都会变成灰色,并且程序只会执行而不会在断点处停止。

DebugMenu

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

最佳答案

这是我的 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 就是用于此目的的。

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

关于debugging - 在 vscode 中调试 Serverless 时未命中断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46668483/

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