我在OSX上设置了一个最小的Electron应用程序设置,当通过命令行运行时工作正常,但是我无法使用Visual Studio Code在调试模式下运行:
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:13207).
我的launch.json文件如下所示:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/main.js",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"runtimeArgs": [
".",
"--enable-logging"
],
"env": {},
"console": "internalConsole",
"sourceMaps": false
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
非常感谢任何帮助。
答案 0 :(得分:0)
我遇到了同样的问题,这是一个解决方案。
我使用的选举版本不支持--inspect flag,在devDependencies
选项中打开你的package.json,将electron
选项更改为最新版本。截至本文" 1.7.9"