当前位置:网站首页>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_remain.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
边栏推荐
- Sophon autocv: help AI industrial production and realize visual intelligent perception
- 2022新版PMP考试有哪些变化?
- OpenShift常用管理命令杂记
- Isprs2022 / Cloud Detection: Cloud Detection with Boundary nets Boundary Networks Based Cloud Detection
- [paddleclas] common commands
- 华夏基金:基金行业数字化转型实践成果分享
- 基于YOLOv3的口罩佩戴检测
- Maximum artificial island [how to make all nodes of a connected component record the total number of nodes? + number the connected component]
- ISPRS2022/云检测:Cloud detection with boundary nets基于边界网的云检测
- 热通孔的有效放置如何改善PCB设计中的热管理?
猜你喜欢

Leetcode daily question: the first unique character in the string

Configure pytorch environment in Anaconda - win10 system (small white packet meeting)

FCN: Fully Convolutional Networks for Semantic Segmentation

图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统

Zabbix

职场进阶指南:大厂人必看书籍推荐

mybash

Matlab reference

Simulate the hundred prisoner problem

LeetCode 练习——206. 反转链表
随机推荐
Gimp 2.10 tutorial "suggestions collection"
登录连接 CDB 和 PDB
2022新版PMP考试有哪些变化?
Read libco save and restore the on-site assembly code
FCN: Fully Convolutional Networks for Semantic Segmentation
Redis Foundation
[performance test] full link voltage test
隐私计算助力数据的安全流通与共享
苹果手机炒股安全吗?打新债是骗局吗?
Failed to virtualize table with JMeter
Unicode processing in response of flash interface
EPM相关
RSE2020/云检测:基于弱监督深度学习的高分辨率遥感图像精确云检测
消除`if()else{ }`写法
ITK Example
Six bad safety habits in the development of enterprise digitalization, each of which is very dangerous!
nacos -分布式事务-Seata** linux安装jdk ,mysql5.7启动nacos配置ideal 调用接口配合 (保姆级细节教程)
MATLAB中print函数使用
ITK Example
Easynmon Usage Summary