electron常见错误

Reserved header is not 0 or image type is not icon for 'xxx.ico'

ico文件报错使用正规工具生成xxx.ico文件

electron-packager  不是内部或外部命令,也不是可运行的程序

electron-packager安装失败,重新安装electron-packager

electron-builder安装出现cannot find module fs/promises

 这是nodejs版本太低导致的


1、可以通过升级nodejs的方式解决(win7 nodejs最高只能到v12.16.2,v12.16.2以上需要升级windows)
2、在项目的node_modules文件夹中找到electron-builder文件夹,搜索该文件夹中所有require("fs/promises"),直接全部替换为require("fs").promises,然后打包
3、全局安装地址:C:/Users/xxxx/AppData/Roaming/npm/node_modules/electron-builder/

electron-builder打包报错Get "https://github.com/electron/electron/releases/download/v17.1.0/electron-v17.1.0-win32-x64.zip": dial tcp 20.205.243.166:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

无法下载git上electron运行包


1、手动下载https://github.com/electron/electron/releases/download/v17.1.0/electron-v17.1.0-win32-x64.zip,将压缩包放入package.json里electron安装更新文件夹
2、修改网络防火墙等配置

Application entry file "main.js" in the "Z:\electrontest\build\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.  failedTask=build stackTrace

在 package.json 的 build 下的 files 里添加要打包到 asar 中的文件
    
例:

"build": {
        "files": [
                "app/index.html",
                "app/main.js",
                "app/package.json",
                "dist/electron/**/*"

        ]

}

安装ffi-napi 报错:Can't find Python executable "python", you can set the PYTHON env variable

需要安装配置Python与node-gyp


注:electron并不支持python3.x,手动安装需要下载2.7版本,vs2015版本
    
cnpm install --global --production windows-build-tools
npm install --global node-gyp

npm安装windows-build-tools卡住,停在了Successfully installed Python 2.7

1、保证你安装了Visual Studio
2、在资源管理中搜索%temp% ,window系统按住win按键直接搜索就可以
3、在搜索到的文件夹%temp% 中创建dd_client_.log文件,并且填入内容Closing installer. Return code: 3010.

引用dll报错 Error: Dynamic Symbol Retrieval Error: Win32 error 127

方法对不上,js的方法c++没有定义

引用dll报错 Error: Dynamic Linking Error: Win32 error 193

dll 位数不对应,例如electron是32位的dll是64位的

打包后报错 ffi Error:Dynamic Linking Error:Win32 error 126

情况1:需要在打包配置中额外将dll文件打包进去
"extraResources":[{
        "from":"./resources/DLLDemo1.dll",                                 dll文件访问地址
        "to":"./"

}],
    

情况2:需要在运行的环境上安装打包文件的dll运行环境

npm install --global --production windows-build-tools
    
情况3:重新打包dll,使dll可以再任何平台上运行的


Visual studio开发:
        3.1如果是MFC类型exe文件或者dll文件,直接在 配置属性->常规->MFC的使用 中选择在静态库中使用MFC即可
        3.2如果是非MFC类型的exe文件或者dll,则需要 调整 配置属性->C/C++->代码生成 ->运行库 中选择 多线程调试(/MT) 类型

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在使用electron和bytenode进行加密打包时,你可能会遇到一些问题。一个常见的问题是在控制台遇到报错"Invalid or incompatible cached data"。这个问题通常是由于使用bytecode编译js文件时,所使用的node环境与electron集成的node环境不兼容所导致的。为了解决这个问题,你可以尝试以下方法: 1. 下载一个与electron-node环境一致的node版本,并重新安装。这样可以确保编译生成的字节码文件与electron环境兼容。 2. 在electron的调试窗口中打开控制台,并输入bytecode编译指令,重新生成一个jsc文件。然后重新加载这个文件,看是否能解决问题。 引用\[1\]中的作者就是通过这种方法解决了类似的问题,并分享给大家。 另外,bytenode还有一些局限性。例如,它在与主程序交互、进行异步操作和引用外部模块时存在一些限制。在字节码中使用require会提示未定义,这个问题在2015年就有人提出了,但至今仍然存在\[3\]。因此,对于这些问题,bytenode的实用性会有所打折扣。 总结来说,使用electron和bytenode进行加密打包时,你可以尝试下载与electron-node环境一致的node版本来解决兼容性问题。同时,要注意bytenode的一些局限性,特别是在与主程序交互、进行异步操作和引用外部模块时的限制。 #### 引用[.reference_title] - *1* *2* *3* [Electron源代码的终极加密保护方案——使用bytenode(包括不兼容错误的处理技巧)](https://blog.csdn.net/renzhezixuan/article/details/108159106)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值