為你的工作區啟動 Launch.json
-
從選單 - 檢視>除錯開啟除錯
-
它在啟動除錯期間返回一些錯誤,顯示彈出通知並從此彈出通知中開啟 launch.json 這只是因為沒有為你的工作區設定 launch.json。將程式碼複製並貼上到 launch.json // new launch.json
你的舊 launch.json
{ “version”: “0.2.0”, “configurations”: [ { “name”: “Launch Extension”, “type”: “extensionHost”, “request”: “launch”, “runtimeExecutable”: “${execPath}”, “args”: [ “–extensionDevelopmentPath=${workspaceRoot}” ], “stopOnEntry”: false, “sourceMaps”: true, “outDir”: “${workspaceRoot}/out”, “preLaunchTask”: “npm” } ] }
現在更新你的 launch.json,如下面的
新 launch.json
** //請記住你的 main.js 路徑**
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app/main.js", // put your main.js path
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"console": "internalConsole",
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
},
{
"name": "Attach to Process",
"type": "node",
"request": "attach",
"processId": "${command.PickProcess}",
"port": 5858,
"sourceMaps": false,
"outDir": null
}
]
}
- 現在它除錯正在執行,顯示通知彈出逐步除錯