1.安装nodejs (略)
2.electron安装:
npm install electron --save-dev --save-exact
3.clone官方提供的项目:
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start
4.vs code打开electron-quick-start项目;
5.配置 VSCode 的Node 启动:
选择左侧测试标签页,点击配置下拉列表,选择添加配置,
选择Node.js,
这时会在你的项目中 自动添加 .vscode 文件夹 并创建 launch.json 文件。
6.配置 VSCode 启动 Electron(参考:https://electronjs.org/docs/tutorial/debugging-main-process-vscode):
添加一个 .vscode/launch.json 文件并使用以下配置:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"args" : ["."],
"outputCapture": "std"
}
]
}