1、node.js下载,然后安装。下载地址:链接:http://pan.baidu.com/s/1o7TONhS 密码:fosa

2、cmd下输入:npm install electron-prebuilt -g

3、解压这个文件,然后双击exe

4、创建一个文件夹,里面创建三个文件

package.jsonmain.jsindex.html

内容:

package.json

{
"name" : "your-app",
"version" : "0.1.0",
"main" : "main.js"
} main.js const electron = require('electron');
// Module to control application life.
const {app} = electron;
// Module to create native browser window.
const {BrowserWindow} = electron; // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win; function createWindow() {
// Create the browser window.
win = new BrowserWindow({width: , height: }); // and load the index.html of the app.
win.loadURL(`file://${__dirname}/index.html`); // Open the DevTools.
win.webContents.openDevTools(); // Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
} // This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow); // Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
}); app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
}); // In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here. index.html <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</body>
</html>

然后将整个文件夹,拖到Electron.exe中,显示效果如下图所示:

我学习的地址是:

http://blog.csdn.net/xuexiiphone/article/details/51445369

感谢技术朋友分享

electron安装到第一个实例的更多相关文章

  1. 【C# -- OpenCV】Emgu CV 第一个实例

    原文 [C# -- OpenCV]Emgu CV 第一个实例 Emgu CV下载地址 http://sourceforge.net/projects/emgucv/files/ 找最新的下就行了,傻瓜 ...

  2. Vue.js学习和第一个实例

    第一个实例效果图: 1.node.js下载,然后安装.下载地址:链接:http://pan.baidu.com/s/1o7TONhS 密码:fosa 2.下载Vue.js.链接:http://pan. ...

  3. Activity工作流(2)-入门安装运行第一个例子

    转: Activity工作流(2)-入门安装运行第一个例子 置顶 2017年05月24日 15:58:50 li_ch_ch 阅读数:24432   版权声明:本文为博主原创文章,未经博主允许不得转载 ...

  4. JAVA-MyEclipse第一个实例

    相关资料: <21天学通Java Web开发> 实例代码: MyEclipse第一个实例1.打开MyEclipse程序.2.在PacKage视图->右击->New|Web Pr ...

  5. Windows上安装多个MySQL实例(转)

    在学习和开发过程中有时候会用到多个MySQL数据库,比如Master-Slave集群.分库分表,开发阶段在一台机器上安装多个MySQL实例就显得方便不少. 在 MySQL教程-基础篇-1.1-Wind ...

  6. 小白的springboot之路(一)、环境搭建、第一个实例

    小白的springboot之路(一).环境搭建.第一个实例 0- 前言 Spring boot + spring cloud + vue 的微服务架构技术栈,那简直是爽得不要不要的,怎么爽法,自行度娘 ...

  7. 在一台Linux服务器上安装多个MySQL实例(一)--使用mysqld_multi方式

    (一)MySQL多实例概述 实例是进程与内存的一个概述,所谓MySQL多实例,就是在服务器上启动多个相同的MySQL进程,运行在不同的端口(如3306,3307,3308),通过不同的端口对外提供服务 ...

  8. Electron安装过程深入解析(读完此文解决Electron应用无法启动,无法打包的问题)

    1. 安装Electron依赖包 开发者往往通过npm install(或 yarn add)指令完成为Node.js工程安装依赖包的工作, 安装Electron也不例外,下面是npm和yarn的安装 ...

  9. 第四课 Grid Control实验 GC Agent安装(第一台机器部署) 及卸载

    3.GC Agent安装(第一台机器部署) 安装Agent 拷贝agent,现在ocm2机器上查找agent.linux  查找文件的方法: find ./ -name agent*linux 把ag ...

随机推荐

  1. springboot(整合事务和分布式事务)

    springboot +mybatis 单数据源,事务 事务:简单理解指的是一组操作,里面包含许多个单一的逻辑,只要有一个逻辑没有执行成功 ,那么都算失败.所有的数据都回归到最初的状态(回滚) 代码实 ...

  2. 『Hi,我是易建科技eKing Cloud!』

    写在前面:这是我的第一篇自我介绍式文章,是对易建科技我所在云服务事业群的云平台产品和业务的总结和介绍.本文始发于 Linux宝库 公众号,这是原文链接.感谢公众号主人陈绪总,感谢公众号的编辑们!感谢易 ...

  3. C语言强化——链表(1)

    目录 链表的增删(不带头结点) 链表相关面试题 合并两个有序链表 单链表原地逆置 找出链表的倒数第四个节点 找出链表的中间节点 判断单链表是否有环 求链表交点 删除有序单链表中重复的元素 链表按奇数. ...

  4. Volley封装

    Volley.jar下载 在Application初始化 Volley queues=Volley.newRequestQueue(appContext); 并返回RequestQueue 对象 pu ...

  5. win7 没有权限使用网络资源

    局域网下同一工作组电脑无法访问 提示"....没有权限使用网络资源...." 一.组策略 win + R 输入gpedit.msc并回车,打开本地组策略编辑器 按如下展开 计算机配 ...

  6. SAS FORMAT 逻辑库存储 【输出格式 没有找到或无法加载】解决方法

    SAS FORMAT 逻辑库存储 [输出格式  没有找到或无法加载]解决方法:需要指定FORMAT 搜索的路径:OPTIONS FMTSEARCH=(F WORK); 以下为完整示例代码: 00@DA ...

  7. WebBrowser JS回调delphi的方法 (简单通用)

    上一部分讲了Delphi根据方法名调用方法,这一部分还有用到,接着上一章: [主要原理] 通过TEmbeddedWB控件的OnShowMessage事件捕获弹窗来实现,弹窗时定义方法名和参数,在捕获方 ...

  8. SDOI2018物理实验

    /* 向量运算不会呐 抄了一个长度几百行的模板 一直过不了编译 醉了 还是抄了大佬的代码 首先把所有的线段投影到 导轨上 然后用set 分上和下分别维护一下 距离导轨最近的线段 是能够照射到的 可以证 ...

  9. TableStore:多行数据操作

    1.批量写 public static void batchWriteRow(SyncClient client) { BatchWriteRowRequest request = new Batch ...

  10. redis的哨兵集群,redis-cluster

    #主从同步redis主从优先1.保证数据安全,主从机器两份数据一主多从2.读写分离,缓解主库压力主redis,可读可写slave身份,只读   缺点1.手动主从切换假如主库挂了,得手动切换master ...