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


相关推荐

  • dropdownlist控件绑定数据库_凡科可以绑定数据库吗

    dropdownlist控件绑定数据库_凡科可以绑定数据库吗DropDownList1.DataSource=myReader;//myReader为ExecuteReader()的结果集DropDownList1.DataTextField(DataValueField)=”填充在myReader中的数据集,用哪个列填充就写哪个列名就ok了”;DropDownList1.DataBind();aspx页面上有三个DropDownLi

    2022年10月8日
    3
  • kotlin和java互转

    kotlin和java互转其实就是互转 以下基于 IDEA 或 AndroidStudi 转 Kotlin 打开要转的文件方法 1Ctrl Shift Alt K 方法 2Code ConvertJavaF 转 JavaTools gt Kotlin gt ShowKotlinBy

    2025年6月18日
    2
  • sqlserver中日期转字符串「建议收藏」

    sqlserver中日期转字符串「建议收藏」SelectCONVERT(varchar(100),GETDATE(),0):0516200610:57AMSelectCONVERT(varchar(100),GETDATE(),1):05/16/06SelectCONVERT(varchar(100),GETDATE(),2):06.05.16SelectCONVERT(varchar(100),GETDATE(),3):16/05/06SelectCONVERT(varchar(10.

    2022年10月8日
    3
  • Linux Platform Device and Driver「建议收藏」

    Linux Platform Device and Driver「建议收藏」 从Linux2.6起引入了一套新的驱动管理和注册机制:Platform_device和Platform_driver。Linux中大部分的设备驱动,都可以使用这套机制, 设备用Platform_device表示,驱动用Platform_driver进行注册。 Linuxplatformdriver机制和传统的devicedriver 机制(通过driver_registe

    2022年7月24日
    11
  • Vue的axios封装

    Vue的axios封装Vue 的 axios 封装在 vue 项目中 经常需要封装 axios 文档又看不懂 所以总结一下方法 安装 npminstallax 安装 axios 引入在项目的 src 目录中 新建一个 request 文件夹 然后在里面新建一个 http js 和一个 api js 文件 http js 文件用来封装我们的 axios api js 用来统一管理我们的接口 在 http js 中引入 axiosimporta axios 引入 axiosimportQ

    2025年7月10日
    2
  • 曼昆经济学原理_第五版[1].txt.doc

    曼昆经济学原理_第五版[1].txt.doc第一章经济学十大原理在本章中你将——知道经济学研究稀缺性资源配置考察人们面临的一些交替关系知道机会成本的含义懂得在作出决策时如何运用边际推理讨论激励如何影响人们的行为考虑为什么人们或国家之间的交易可以使各方面受益-9经济学原理第五版 讨论为什么市场是一种良好的、但并不是完善的资源配置方式了解是什么因

    2025年8月2日
    2

发表回复

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

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