VSCode 如何运行调试全局安装的 Electron

引用:https://blog.csdn.net/Likianta/article/details/89048938

 

run.cmd 文件

electron . --inspect=5858

 

launch.json文件

复制代码
{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            // "type": "node",
            // "request": "launch",
            // "name": "启动程序",
            // "skipFiles": [
            //     "<node_internals>/**"
            // ],
            // "program": "${workspaceFolder}/index.js",
            // "stopOnEntry": false, 
            // "args": [ ], 
            // "cwd": "${workspaceRoot}", 
            // "preLaunchTask": null, 
            // //"runtimeExecutable": "${workspaceRoot}/node_modules/electron/dist/electron.exe", 
            // //"runtimeExecutable": "D:/SoftWare/node-v14.16.0-win-x64/npm_global/node_modules/electron/dist/",
            // "runtimeExecutable": "${workspaceFolder}/run.cmd",
            // // "runtimeArgs": [
            // //     "--nolazy"
            // // ], 
            // //"runtimeArgs": ["."],
            // "env": {
            //     "NODE_ENV": "development"
            // }, 
            
            // //"externalConsole": false, 
            // "sourceMaps": false
            // //"outDir": null
            "type": "node",
            "request": "launch",
            "name": "Electron Main",
            // "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
            "runtimeExecutable": "${workspaceFolder}/run.cmd",  // 通过调用 run.cmd 启动
            "program": "${workspaceFolder}/index.js",
            "port": 5858
        }
    ]
}
复制代码

 

注意:重启vscode

 

之前会报:

Can't find Node.js binary "node":path does not exist.Make sure Node.js is installed and in your PATH, or set the runtimeExecutable" in your launch.json

原因是配置目录(runtimeExecutable)而不是exe

posted @   三瑞  阅读(1143)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2019-04-03 easyui dialog 中 panel-body 高度太小出现 滚动条 的原因
2018-04-03 asp:LinkBtton PostBackUrl 中文乱码
点击右上角即可分享
微信分享提示