当前位置: 首页 > news >正文

electron 升级 v22 遇到问题

Electron 漏洞
https://mp.weixin.qq.com/s/5LpSJb_5uV8EIDOl3fz9Tw

在这里插入图片描述
由于 23以上不在支持win 7 8 8.1
在这里插入图片描述
所以我选择安装 v22.3.24

electron 22.3.24
node-sass 6.0.1
sass-loader 10.4.1
在这里插入图片描述
对应的版本
在这里插入图片描述

npm i node-sass@6.0.1 --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
npm i -D sass-loader@10.x

以下是我开发中遇到的问题

  1. const fs = require(“fs”) 报错未定义requir ncaught ReferenceError: require is not defined
win = new BrowserWindow({webPreferences:{nodeIntegration:true, contextIsolation:false }
})
  1. Syntax Error: TypeError: this.getOptions is not a function
    开始爬坑的时候 node node-sass sass-loader 三个的版本不匹配
    最终选择我上面用的这三个版本号 就可以

3.Syntax Error: Error: Node Sass version 9.0.0 is incompatible with ^4.0.0.
node-sass 的版本太高需要降级

  1. Cannot read properties of undefined (reading ‘app’) at new ElectronStore
npm i electron-store@latest

另外需要更改的代码

// 你的入口文件 main.js
protocol.registerSchemesAsPrivileged([{ scheme: "app", privileges: { standard: true, secure: true } },
]);function createWindow() {
win = new BrowserWindow({width: 650,height: 550,webPreferences: {contextIsolation: false,webSecurity: true,nodeIntegration: true,},});
}package.json // 不再支持 main 所以换成 exports"exports": {".": "./main.js"},
http://www.lryc.cn/news/193177.html

相关文章:

  • 跟我学c++中级篇——Pimpl
  • [补题记录] Atcoder Beginner Contest 295(E)
  • 解决git在window11操作很慢,占用很大cpu的问题
  • C++智能指针(二)——weak_ptr初探
  • 540 - Team Queue (UVA)
  • 投资组合之如何估值
  • 2024届通信工程保研经验分享(预推免入营即offer)
  • L2-025 分而治之 - java
  • Python+高光谱数据预处理-机器学习-深度学习-图像分类-参数回归
  • 免费 AI 编程助手 Amazon CodeWhisperer 体验
  • 【Linux】从零开始学习Linux基本指令(一)
  • Java GC 算法
  • vue3 v-html中使用v-viewer
  • Leetcode算法解析——查找总价格为目标值的两个商品
  • unity游戏开发引擎unity3D开发
  • iptables
  • 竞赛 深度学习LSTM新冠数据预测
  • Spark入门
  • react–antd 实现TreeSelect树形选择组件,实现点开一层调一次接口
  • android 固定进度环形刷新效果
  • python jieba 词性标注 中文词性分类 nlp jieba.posseg
  • LeetCode 每日一题 2023/10/9-2023/10/15
  • 相似性搜索:第 3 部分--混合倒排文件索引和产品量化
  • 小程序使用uni.createAnimation只执行一次的问题
  • win10取消ie浏览器自动跳转edge浏览器
  • 目录启示:使用 use 关键字为命名空间内的元素建立非限定名称
  • Go语言介绍与安装
  • 常用傅里叶变换表
  • 生活中的视音频技术
  • 一种用于肽图分析的烷化剂,Desthiobiotin-Iodoacetamide