当前位置:网站首页>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
边栏推荐
- 访问数据库使用redis作为mysql的缓存(redis和mysql结合)
- Sentinel flow guard
- 吴恩达团队2022机器学习课程,来啦
- 检查命名空间和类
- Star Ring Technology launched transwarp Navier, a data element circulation platform, to help enterprises achieve secure data circulation and collaboration under privacy protection
- Size_ T is unsigned
- EPM related
- [performance test] full link voltage test
- About Estimation with Cross-Validation
- 通过SOCKS代理渗透整个内网
猜你喜欢
GFS分布式文件系统
IDC report: Tencent cloud database ranks top 2 in the relational database market!
Find the first k small element select_ k
ISPRS2022/雲檢測:Cloud detection with boundary nets基於邊界網的雲檢測
GFS distributed file system
Ten capabilities that cyber threat analysts should have
Redis Foundation
第十届全球云计算大会 | 华云数据荣获“2013-2022十周年特别贡献奖”
pytorch yolov5 训练自定义数据
使用Jmeter虚拟化table失败
随机推荐
Record a case of using WinDbg to analyze memory "leakage"
[BeanShell] there are many ways to write data locally
Huaxia Fund: sharing of practical achievements of digital transformation in the fund industry
登录连接 CDB 和 PDB
Cmake tutorial Step2 (add Library)
[TestLink] testlink1.9.18 solutions to common problems
Neural network self cognition model
Teamcenter 消息注册前操作或後操作
南京大学:新时代数字化人才培养方案探讨
Sophon AutoCV:助力AI工业化生产,实现视觉智能感知
Leetcode daily question: the first unique character in the string
EasyCVR平台通过接口编辑通道出现报错“ID不能为空”,是什么原因?
分享:中兴 远航 30 pro root 解锁BL magisk ZTE 7532N 8040N 9041N 刷机 刷面具原厂刷机包 root方法下载
Cmake tutorial step1 (basic starting point)
星环科技数据安全管理平台 Defensor重磅发布
Crontab 日志:如何记录我的 Cron 脚本的输出
Numerical calculation method chapter8 Numerical solutions of ordinary differential equations
Anaconda中配置PyTorch环境——win10系统(小白包会)
Star Ring Technology launched transwarp Navier, a data element circulation platform, to help enterprises achieve secure data circulation and collaboration under privacy protection
Size_t 是无符号的