为你的工作区启动 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
}
]
}
- 现在它调试正在运行,显示通知弹出逐步调试