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


相关推荐

  • cuda编程基础(编程软件有哪些)

    CUDA(ComputeUnifiedDeviceArchitecture),是显卡厂商NVIDIA推出的运算平台。CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题。

    2022年4月18日
  • pip和conda安装与卸载tensorflow、pycharm中使用特定的conda虚拟环境「建议收藏」

    pip和conda安装与卸载tensorflow、pycharm中使用特定的conda虚拟环境「建议收藏」写吴恩达dp作业做的准备参考https://blog.csdn.net/ccgcccccc/article/details/89058445根据他的配置要求来配置文件pipinstalltensorflow==1.13.0rc2-ihttps://pypi.tuna.tsinghua.edu.cn/simple或者-ihttps://mirrors.aliyun.com/py…

    2022年6月22日
  • vue引入vant_vueaxios跨域请求

    vue引入vant_vueaxios跨域请求因为后端给的接口不是本地的接口,所以需要跨域来获取接口数据在vue.config.js中对其进行配置devServer:{host:’localhost’,port:3030,//端口https:false,proxy:{//配置跨域’/api’:{target:’http://xx.xx.xx.xxx’,//代理的接口域名以及端口号;ws:

    2022年9月27日
  • Windows注入与拦截(1) — DLL注入的基本原理「建议收藏」

    Windows注入与拦截(1) — DLL注入的基本原理「建议收藏」一.DLL注入技术的用途从前面的《Windows内存体系》系列文章中我们可以知道,在Windows系统中,每个进程都有自己私有的地址空间。当我们用指针来引用内存的时候,指针的值表示的是进程自己的地址空间的一个虚拟的内存地址。进程不能通过指针来引用其他进程地址空间的内存。因此,如果一个进程有缺陷会导致其引用和覆盖随机地址处的内存,那么这个缺陷的影响就会不会扩散到其他的进程。独立的地址空间有…

    2022年5月13日
  • 10月22日Ajax培训日记

    10月22日Ajax培训日记今天还是由梁言兵老师讲解Ajax,根据昨天学员的反馈,觉得AjaxTable这个项目太大了,学习起来有点费劲,希望梁老师讲一个较小的综合案例。所以,梁老师先讲解XTree这个客户端JavaScript组件,然后结合XTree,buffalo,spring,hibernate这些框架开发一个Ajax的demo。小收获:varobj={a:’xxx’b:function(){}}定义…

    2022年9月12日
  • request 和require区别_合同翻译时如何区分使用request和require

    request 和require区别_合同翻译时如何区分使用request和require合同中,request和require都是“要求”的意思,不过request更偏重于“请求”,翻译英到中时遇到这两个词问题不大,翻译出它们的意思就可以,但是中译英时就要注意了,这是我今天要强调的重要区别,前者动作发出者通常为人,后者通常为物,下面通过例句说明:1requestAttherequestoftheBuyer,theSUPPLIERundertakestodeposi…

    2022年10月22日

发表回复

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

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