electron 安装_electron修改文件描述

electron 安装_electron修改文件描述1、安装node.js例如:安装在F://node下;2、cmd控制台:F:回车,进入F盘,cdnode回车,进入node文件夹,node-v回车,查看node版本,npm-v回车,查看npm版本,若出现版本号,表示安装成功;3、在cmd控制台,node文件夹下,把npm仓库切换到国内taobao仓库,速度会快很多,命令如下:npminstall-gcnpm–registry=https://registry.npm.taobao.org

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

1、安装node.js 例如:安装在 F://node 下;

2、cmd控制台:

F: 

Jetbrains全家桶1年46,售后保障稳定

回车,进入F盘,

cd node

回车,进入node文件夹,

node -v

回车,查看node版本,

npm -v

回车,查看npm版本,若出现版本号,表示安装成功;

3、在cmd控制台,node文件夹下,把npm仓库切换到国内taobao仓库,速度会快很多,命令如下:

  npm install -g cnpm --registry=https://registry.npm.taobao.org

4、在node文件夹下,安装electron,命令如下:

  cnpm install -g electron

5、输入命令:

  electron -v

查看electron版本,若出现版本号,表示安装成功;

6、输入命令:

cnpm install -g electron-packager

打包输出工具;

7、下载并安装electron客户端;

8、新建一个项目文件夹,自命名,例如:test1;

9、在 test1 中创建:pakage.json、index.html、main.js 三个文件;

10、通过拖拽 test1 文件夹到 electron客户端,或者在cmd控制台中使用命令打开文件,

F:\electron1\electron.exe E:\electronCodes\test1

前段为客户端地址,后段为文件地址

附录:pakage.json、index.html、main.js

pakage.json:

{ 
   
  "name"    : "your-app",
  "version" : "0.1.0",
  "main"    : "main.js"
}

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>

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: 800, height: 600});

  // 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.
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/234522.html原文链接:https://javaforall.net

(0)
上一篇 2025年6月2日 上午9:15
下一篇 2025年6月2日 上午9:43


相关推荐

  • navicat oracle存储过程,Navicat 运行 Oracle 存储过程示例

    navicat oracle存储过程,Navicat 运行 Oracle 存储过程示例navicat存储过程界面功能点击运行时,会弹出窗口填入输入参数。使用Navicat创建存储过程在函数位置,右键新建函数,OUT参数没有默认值,写了也没用。软件自动生成存储过程框架,然后人去补充“声明变量”和“主体”部分,注意存储过程名称可以用引号,也可以不用引号。Navicat运行存储过程方法一:使用Navicat软件界面功能方法二:在查询界面创建变量并调用存储过程Orac…

    2022年7月17日
    86
  • Win10系统开机后卡在“请稍后”界面很长时间才能进入

    Win10系统开机后卡在“请稍后”界面很长时间才能进入起因是电脑上总是出现很多弹窗 上网搜索网友推荐下载 火绒 弹窗拦截的较多 而我呢又不想使用火绒的安全软件 只想用他的弹窗工具 所以网上搜索了一些弹窗的独立版 下载安装后 弹窗倒是拦截了一部分 但是开机启动立马变得很慢很慢 卸了这个软件也不行 有网上搜了很多方法 都无济于事 图片源于网络 侵删 后来下载了个 Windows 优化大师 把所有能优化的全点了一遍 这个问题竟神奇的消失了 有同样问题的 可以下载一个试试

    2026年3月20日
    2
  • 解决定时器关闭不掉的问题,clearInterval无效

    解决定时器关闭不掉的问题,clearInterval无效1.环境问题,this.interVal是我定义的定时器如直接写clearInterval(this.interVal);不好用,需要换成window.clearInterval(this.interVal);2.关闭指令执行的定时器源头问题,如开启了多个定时器,再去清除定时器是无效的,因为无法定位到想清除的定时器上。解决办法,将定时器归一每次开启定时器时,判断一下定时器是否存在,这样万无一失。开启:if(!this.interVal){this.interVal=

    2025年8月14日
    5
  • opencv学习笔记之对灰度图像遍历的三种方法

    opencv学习笔记之对灰度图像遍历的三种方法灰度图像遍历的三种方法通过指针访问 通过迭代器访问 动态地址计算,通过at()函数实现、实现代码:#include#includeusingnamespacecv;usingnamespacestd;intmain(){ MatImg=imread(“1.jpg”,0); if(!Img.data){cout<

    2022年5月7日
    140
  • 从零开始的AI员工计划:OpenClaw + 700+ Skills 免费部署指南

    从零开始的AI员工计划:OpenClaw + 700+ Skills 免费部署指南

    2026年3月13日
    3
  • 超声波雷达介绍及车位探测信号处理方法「建议收藏」

    超声波雷达介绍及车位探测信号处理方法「建议收藏」1、超声波雷达介绍超声波雷达的工作原理是通过超声波发射装置向外发出超声波,到通过接收器接收到发送过来超声波时的时间差来测算距离。特性一:温度敏感特性二:无法精确描述障碍物位置(接收到的只是距离,并不知道具体方向)雷达探测范围数字模型:参数α:超声波雷达的探测角参数β:检测宽度范围影响因素之一,UPA的β角为20°左右,APA的β角比较特殊,为0…

    2025年10月29日
    5

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号