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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • java 对象拷贝方法beanutils_java copy方法

    java 对象拷贝方法beanutils_java copy方法一、简介:BeanUtils提供对Java反射和自省API的包装。其主要目的是利用反射机制对JavaBean的属性进行处理。我们知道,一个JavaBean通常包含了大量的属性,很多情况下,对JavaBean的处理导致大量get/set代码堆积,增加了代码长度和阅读代码的难度。二、用法:如果你有两个具有很多相同属性的JavaBean,一个很常见的情况…

    2022年9月28日
    1
  • Struts2—->action

    Struts2—->action

    2021年8月19日
    49
  • linux生成md5文件_keil5如何生成bin文件

    linux生成md5文件_keil5如何生成bin文件MDK5如何生成bin文件MDK5在生成bin文件时经常会遇到找不到文件路径导致的生成失败,采用下面这条命令可以直接在.axf目录下生成对应的bin文件:再mdk的Target->User下面这条命令:fromelf.exe–bin-o“$L@L.bin”“#L”生成结果:…

    2022年10月20日
    3
  • python与java的区别(java 和python)

    java和python区别Python或Java,哪个更好?这个问题在全球开发者社区引发了许多激烈的讨论。初学者开发人员可能对应该掌握两者中的哪一个有所怀疑。初创公司和公司可能想知道哪种方案在他们的下一个项目中会更好。这两种语言都可以以相同的效率解决许多任务,这不足为奇。但是,在某些情况下,一个人可以击败另一个人。在本文中,我们将基于多个方面来分析它们的优缺点。对于那…

    2022年4月18日
    85
  • Android语音采集两种方式MediaRecorder和AudioRecord

    Android语音采集两种方式MediaRecorder和AudioRecord

    2021年8月31日
    76
  • Oracle数据库运维方案及优化

    Oracle数据库运维方案及优化Oracle数据库优化运维优化文章目录Oracle数据库优化前言:Oracle数据库性能优化一为啥要运维,运维哪些内容?二检查数据库基本状况2.1检查Oracle实例状态2.2检查Oracle服务进程2.3检查Oracle监听状态三检查系统和oracle日志文件四检查Oracle对象状态前言:在上一篇文章中我们讲了关于Oracle数据库的性能方面的优化,这篇文章咱们讲讲关于运维方面的优化吧。上一篇文章的地址:Oracle数据库性能优化一为啥要运维,运维哪些内容?数据库的运维主

    2025年8月19日
    4

发表回复

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

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