2017-10-10 142 views
2

在VSCode中調試基於無服務器的應用程序時,沒有任何斷點處於活動狀態。在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" 
}, 
.... 

當我從菜單中選擇開始調試,所有的紅色斷點去灰色和程序公正的執行沒有停止在斷點。

DebugMenu

我正在節點6.11.2,Mac上的無服務器1.23.0。謝謝大家。

回答

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就是這樣。

我希望這可以指引您正確的方向。

相關問題