Ste*_*pii 5 javascript node.js forge electron visual-studio-code
我正在尝试使用 VSCode(电子主进程,而不是渲染)调试我的电子锻造项目,但到处都是错误。我安装了electron-forge
包含所有依赖项的包并初始化我的项目。
我遵循了这个指令,我launch.json
的 VSCode 是:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Main",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-forge-vscode-win.cmd",
"cwd": "${workspaceRoot}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是当我F5
在 VSCode 中进行调试时,我得到了Attribute "runtimeExecutable" does not exist
因为electron-forge
是全局安装的,所以node_modules/.bin/
目录中没有这样的文件。
然后根据this我改变了"runtimeExecutable"
我的launch.json
如下:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Main",
"runtimeExecutable": "electron-forge-vscode-win.cmd",
"cwd": "${workspaceRoot}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
命令行是:
electron-forge-vscode-win.cmd --debug-brk=17423 --nolazy
? Locating Application
? Preparing native dependencies
? Launching Application
Run Code Online (Sandbox Code Playgroud)
但仍然没有发生任何事情。我的电子应用程序启动了,但没有像--debug-brk
争论那样停止。
接下来,我在我的launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"name": "Electron Main",
"runtimeExecutable": "electron-forge-vscode-win.cmd",
"protocol": "inspector"
}
]
}
Run Code Online (Sandbox Code Playgroud)
使用此命令行启动:
electron-forge-vscode-win.cmd --inspect=11172 --debug-brk
? Locating Application
? Preparing native dependencies
? Launching Application
Run Code Online (Sandbox Code Playgroud)
注意: 11172 是一个随机端口号
而现在我得到这个错误:Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:11172)
。
归档时间: |
|
查看次数: |
1815 次 |
最近记录: |