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. Jenkins XVnc Plugin

    Linux下的Jenkins里配置Webdriver项目会碰到如下错误 org.openqa.selenium.firefox.NotConnectedException: Unable to con ...

  2. react路由嵌套

    所谓的嵌套路由就是在某些以及路由下面存在二级路由,这些二级路由除了公用一级路由导航模块外,还公用当前的二级路由的导航模块,也就是部分进行了切换,要实现嵌套路由,首先回顾之前的内容,实现基本的react ...

  3. 学习笔记之tmux

    Home · tmux/tmux Wiki · GitHub https://github.com/tmux/tmux/wiki tmux is a terminal multiplexer. It ...

  4. MFC 控件使用教程

    combo box控件用法: 下拉选择控件,首先将控件拖动到你需要使用控件的地方,用ClassWizard为它关联一个变量,我们注意到变量类型是CString型的.右击属性,General中可以设置一 ...

  5. OpenStack单节点制作镜像

    1.创建快照 已修改后的时刻为记录,进行制作镜像,选择要制作镜像的虚拟机,点击创建快照,在所弹出的对话框中输入所创建的镜像名称 生成了一个镜像,类型为Snapshot 2.保存镜像 查看镜像列表 [r ...

  6. 配置允许匿名用户登录访问vsftpd服务,进行文档的上传下载、文档的新建删除等操作

    centos7环境下 临时关闭防火墙 #systemctl stop firewalld 临时关闭selinux #setenforce 0 安装ftp服务 #yum install vsftpd - ...

  7. [UE4]国际化,中英文切换

    只有“Text”数据类型才支持国际化 必须以独立游戏窗口运行,语音切换才会起作用.

  8. 初始Golang

    Golang初识 字节跳动也就是我们常说的今日头条 1.今日头条基于Go语言构建千亿级微服务的实践 今日头条当前后端服务超过80%的流量是跑在Go构建的服务上 微服务数量超过100个 高峰QPS超过7 ...

  9. locals()和globals()

    都是获取当前作用域的内容: locals() 获取局部作用域的所有内容 函数内:获取locals()之前的,当前作用阈所有内容 函数外:获取打印前, 当前的作用域所有内容 在闭包内: 会把使用到的外层 ...

  10. CentOS7 安装 hbase1.3.3

    1. 集群规划 ip地址 机器名 角色 192.168.1.101 palo101 hadoop namenode, hadoop datanode, yarn nodeManager, zookee ...