当前位置:网站首页>Electron安装问题
Electron安装问题
2022-07-05 17:57:00 【寒墨茗殇】
项目输入: npm config edit
在registry 下面添加,并替换了 registry
registry=https://registry.npm.taobao.org/
disturl=https://npm.taobao.org/mirrors/node
electron_mirror=https://cdn.npm.taobao.org/dist/electron/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
安装electron失败 postinstall: `node install.js`
npm config set electron_mirror "https://npm.taobao.org/mirrors/electron/"
Electron预加载:
新建preload.js 在src下面
preload.js:
var electron_re=require('electron')
window.electron=electron_re
main.js:
const {
BrowserWindow,
} = require('electron')
new BrowserWindow({
width: 1100,
height: 720,
minWidth: 1100,
minHeight: 720,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, '/preload.js'),
nativeWindowOpen: true,
contextIsolation: false,//需要false
webSecurity: false
},
icon: `${__static}/icon/favicon.ico`
})
win.loadURL('app://./index.html')
vue.config.js:
module.exports = {
pluginOptions:{
electronBuilder:{
preload:'src/preload.js',
target: "electron-renderer"
}
}
}
打包可能遇到的问题
* 1. 打包时下载electron-v.xxxx.zip文件失败
* 解决办法:直接在淘宝的文件库下载对应版本和打包平台的文件,下载完成后放在 C:\Users\Administrator\AppData\Local\electron\Cache这个目录下
* 2. 打包时下载winCodeSign-v.xxx.7z文件失败
* 下载地址:https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.5.0/winCodeSign-2.5.0.7z
* 下载完解压放到C:\Users\Administrator\AppData\Local\electron-builder\Cache\winCodeSign目录下
* 3. 打包时下载nsis-v.xxx.7z文件失败
* 下载地址:https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
* 下载完解压放到C:\Users\Administrator\AppData\Local\electron-builder\Cache\nsis
* 4. 打包时下载nsis-resources-v.xxx.7z文件失败
* 下载地址:https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.4.1/nsis-resources-3.4.1.7z
* 下载完解压放到C:\Users\Administrator\AppData\Local\electron-builder\Cache\nsis\nsis-resources-3.4.1
边栏推荐
- Huaxia Fund: sharing of practical achievements of digital transformation in the fund industry
- 删除数组中的某几个元素
- Thesis reading_ Chinese NLP_ LTP
- Matlab built-in function how different colors, matlab subsection function different colors drawing
- Data access - entityframework integration
- Simple query cost estimation
- Cmake tutorial Step2 (add Library)
- 检查命名空间和类
- rsync
- Daily exercise: a series of dates
猜你喜欢
RSE2020/云检测:基于弱监督深度学习的高分辨率遥感图像精确云检测
Sophon CE社区版上线,免费Get轻量易用、高效智能的数据分析工具
Maximum artificial island [how to make all nodes of a connected component record the total number of nodes? + number the connected component]
Redis基础
使用QT遍历Json文档及搜索子对象
星环科技重磅推出数据要素流通平台Transwarp Navier,助力企业实现隐私保护下的数据安全流通与协作
Why is all (()) true and any (()) false?
含重复元素取不重复子集[如何取子集?如何去重?]
Ten capabilities that cyber threat analysts should have
修复漏洞 - mysql 、es
随机推荐
Leetcode daily question: the first unique character in the string
Find the first k small element select_ k
ISPRS2020/云检测:Transferring deep learning models for cloud detection between Landsat-8 and Proba-V
图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
Easynmon Usage Summary
2022新版PMP考试有哪些变化?
Size_ T is unsigned
Crontab 日志:如何记录我的 Cron 脚本的输出
Memory management chapter of Kobayashi coding
ISPRS2022/雲檢測:Cloud detection with boundary nets基於邊界網的雲檢測
记一次使用Windbg分析内存“泄漏”的案例
Zabbix
Thesis reading_ Chinese NLP_ LTP
Teamcenter 消息注册前操作或後操作
Sophon AutoCV:助力AI工业化生产,实现视觉智能感知
含重复元素取不重复子集[如何取子集?如何去重?]
Thesis reading_ Medical NLP model_ EMBERT
[JMeter] advanced writing method of JMeter script: all variables, parameters (parameters can be configured by Jenkins), functions, etc. in the interface automation script realize the complete business
集群部署如何解决海量视频接入与大并发需求?
[performance test] full link voltage test