Skip to content

electron-builder打包国产麒麟系统(ARM64架构)

需要再麒麟系统下进行打吧

初始化环境

  • 自行安装前端环境,创建项目,集成electron、electron-builder(最新版即可)

    直接用electron-quick-start也可以

修改electron下载镜像

  • 根目录新建一个.npmrc,复制下面代码,修改electron和electron-builder为淘宝镜像
sh
electron_mirror=https://npmmirror.com/mirrors/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/

项目打包配置

json
    "linux": {
        "icon": "build/icon.png",
        "category": "System",
        "target": {
            "target": "deb",
            "arch": [
                "arm64"
            ]
        }
    },
    "author": {
        "name": "your name",
        "email": "you email"
    }

他配置自行搜一下

安装fpm

  • 因为npm的fpm包只有x86_64的包,打包会报一个可执行文件格式错误的bug
sh
    sudo apt install ruby
    sudo gem install fpm
    cd ~/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-X86_64/
    rm -rf fpm
    In -s /usr/local/bin/fpm fpm

打包deb包

  npm run build:linux