使用 vscode 调试电子。运行时可执行文件
Debug electron with vscode. runtimeExecutable
我无法使用 vscode 在 windows 上调试电子主进程。我已经尝试了我能找到的所有可能的 launch.json
配置,但 app
对象始终是 undefined
。应用程序有效,我只有调试有问题。看来我的 runtimeExecutable
路径是错误的。我试过了 https://discuss.atom.io/t/debugging-electron-api-demo-using-visual-studio-code/40661/2 I've took current configuration from docs https://github.com/electron/electron/blob/master/docs/tutorial/debugging-main-process-vscode.md
我的launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app/main.ts",
"stopOnEntry": false,
"args": ["."],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
"outFiles": [
"${workspaceRoot}/dist/main.js"
],
"env": { },
"sourceMaps": true
}
]
}
谢谢。
根据文档 https://code.visualstudio.com/docs/nodejs/nodejs-debugging Inspector protocol
尚不支持电子。
这是工作配置。应该添加遗留协议。
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app/main.ts",
"stopOnEntry": false,
"args": ["."],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
"outFiles": [
"${workspaceRoot}/dist/main.js"
],
"protocol":"legacy",
"env": { },
"sourceMaps": true
}
]
}
我无法使用 vscode 在 windows 上调试电子主进程。我已经尝试了我能找到的所有可能的 launch.json
配置,但 app
对象始终是 undefined
。应用程序有效,我只有调试有问题。看来我的 runtimeExecutable
路径是错误的。我试过了 https://discuss.atom.io/t/debugging-electron-api-demo-using-visual-studio-code/40661/2 I've took current configuration from docs https://github.com/electron/electron/blob/master/docs/tutorial/debugging-main-process-vscode.md
我的launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app/main.ts",
"stopOnEntry": false,
"args": ["."],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
"outFiles": [
"${workspaceRoot}/dist/main.js"
],
"env": { },
"sourceMaps": true
}
]
}
谢谢。
根据文档 https://code.visualstudio.com/docs/nodejs/nodejs-debugging Inspector protocol
尚不支持电子。
这是工作配置。应该添加遗留协议。
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app/main.ts",
"stopOnEntry": false,
"args": ["."],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
"outFiles": [
"${workspaceRoot}/dist/main.js"
],
"protocol":"legacy",
"env": { },
"sourceMaps": true
}
]
}