You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Electron项目Fedora环境下打包RPM时rpmbuild失败(退出码1)求助

Electron项目Fedora环境下打包RPM时rpmbuild失败(退出码1)求助

各位大佬好,我遇到一个头疼的问题:我用Electron开发的Classify项目,在Windows下打包NSIS安装包、Debian系下打包deb都完全正常,但在Fedora上打包RPM的时候,每次都卡在rpmbuild这一步,直接返回退出码1,已经折腾3天了还是没解决,跪求帮忙看看!

我的package.json配置

{
  "name": "classify",
  "version": "1.0.3",
  "description": "Classify",
  "main": "src/main/main.js",
  "homepage": "https://bushcoding.github.io/classify-downloads",
  "repository": {
    "type": "git",
    "url": "https://github.com/bushcoding/classify-downloads.git"
  },
  "scripts": {
    "start": "electron .",
    "dist": "echo 'Error: Please use one of the platform-specific distribution commands like dist:windows, dist:linux-deb, or dist:linux-rpm' && exit 1",
    "dist:windows": "electron-builder -w --publish never",
    "dist:linux-deb": "electron-builder -l deb --publish never",
    "dist:linux-rpm": "electron-builder -l rpm --publish never",
    "test": "jest"
  },
  "keywords": [
    "file-organizer",
    "desktop-app",
    "electron"
  ],
  "author": {
    "name": "Bush Coding",
    "email": "support@bushcoding.com"
  },
  "license": "ISC",
  "dependencies": {
    "axios": "^1.6.7",
    "electron-store": "^8.1.0",
    "jwt-decode": "^4.0.0"
  },
  "build": {
    "appId": "com.bushcoding.classify",
    "productName": "Classify",
    "artifactName": "ClassifyInstaller-${version}-${os}.${ext}",
    "files": [
      "src/**/*",
      "public/**/*",
      "package.json"
    ],
    "directories": {
      "output": "dist"
    },
    "linux": {
      "icon": "public/assets/icons/512x512.png",
      "executableName": "classify",
      "executableArgs": [
        "--no-sandbox"
      ],
      "category": "Utility",
      "target": [
        "deb",
        "rpm"
      ]
    },
    "win": {
      "icon": "public/assets/icons/512x512.png",
      "target": [
        "nsis"
      ],
      "verifyUpdateCodeSignature": false
    }
  },
  "devDependencies": {
    "electron": "^30.0.9",
    "electron-builder": "^26.0.12",
    "jest": "^30.0.5"
  }
}

执行打包命令后的错误输出

fredericjasmin@fedora:~/Documents/GitHub/classify-client$ npm run dist:linux-rpm

> classify@1.0.3 dist:linux-rpm
> electron-builder -l rpm --publish never

• electron-builder version=26.0.12 os=6.15.9-201.fc42.x86_64
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist/builder-effective-config.yaml
• executing @electron/rebuild electronVersion=30.5.1 arch=x64 buildFromSource=false appDir=./
• installing native dependencies arch=x64
• completed installing native dependencies
• packaging platform=linux arch=x64 electron=30.5.1 appOutDir=dist/linux-unpacked
(node:45062) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated. (Use `node --trace-deprecation ...` to show where the warning was created)
• building target=rpm arch=x64 file=dist/ClassifyInstaller-1.0.3-linux.rpm
• adding autoupdate files for: rpm. (Beta feature) resourceDir=dist/linux-unpacked/resources
⨯ cannot execute cause=exit status 1 out={:timestamp=>"2025-08-18T21:59:50.472740-0600", :message=>"Process failed: rpmbuild failed (exit code 1). Full command was:[\"rpmbuild\", \"-bb\", \"--target\", \"x86_64-unknown-linux\", \"--define\", \"buildroot /tmp/package-rpm-build-b68f2310d3830a3c83dfc66bd4d7312cf3d4b89016459e85543dc86958ef/BUILD\", \"--define\", \"_topdir /tmp/package-rpm-build-b68f2310d3830a3c83dfc66bd4d7312cf3d4b89016459e85543dc86958ef\", \"--define\", \"_sourcedir /tmp/package-rpm-build-b68f2310d3830a3c83dfc66bd4d7312cf3d4b89016459e85543dc86958ef\", \"--define\", \"_rpmdir /tmp/package-rpm-build-b68f2310d3830a3c83dfc66bd4d7312cf3d4b89016459e85543dc86958ef/RPMS\", \"--define\", \"_tmppath /tmp\", \"/tmp/package-rpm-build-b68f2310d3830a3c83dfc66bd4d7312cf3d4b89016459e85543dc86958ef/SPECS/classify.spec\"]", :level=>:error} command=/home/fredericjasmin/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/fpm -s dir --force -t rpm -d gtk3 -d libnotify -d nss -d libXScrnSaver -d '(libXtst or libXtst6)' -d xdg-utils -d at-spi2-...

我尝试过的方向(但没解决)

  • 确认过rpm相关工具已安装,系统提示rpm存在
  • 清理过npm缓存和electron-builder缓存
  • 重新克隆项目从头安装依赖打包

有没有大佬遇到过类似问题?或者能指点下该从哪方面排查?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 07:52:59