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) 类型

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值