electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.47k stars 1.72k forks source link

hdiutil process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE #8183

Closed slhck closed 2 months ago

slhck commented 2 months ago

I am running an M1 Mac.

I am getting this issue now after upgrading electron-builder from 24.9.1 to 24.13.3:

electron-builder build --mac --publish never --x64 --arm64

Output:

  • electron-builder  version=24.13.3 os=23.4.0
  • loaded configuration  file=package.json ("build" field)
  • description is missed in the package.json  appPackageFile=/path/to/project/release/app/package.json
  • writing effective config  file=release/build/builder-effective-config.yaml
  • packaging       platform=darwin arch=x64 electron=29.1.0+wvcus appOutDir=release/build/mac
Signing: /path/to/project/release/build/mac/App.app
 - Verifying existing VMP signature
 - Signature invalid: Certificate is valid for development only
 - Verifying matching VMP signature in cache
 - Signature is valid [streaming, 2275 days of validity], use cached signature
  • signing         file=release/build/mac/App.app platform=darwin type=distribution identity=723761713BF30FC6C8F42202CA5C69F39C8678AA provisioningProfile=none
  • skipped macOS notarization  reason=`notarize` options were set explicitly `false`
  • building        target=macOS zip arch=x64 file=release/build/App-0.9.4-mac.zip
  • building        target=DMG arch=x64 file=release/build/App-0.9.4.dmg
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • packaging       platform=darwin arch=arm64 electron=29.1.0+wvcus appOutDir=release/build/mac-arm64
Signing: /path/to/project/release/build/mac-arm64/App.app
 - Verifying existing VMP signature
 - Signature invalid: Certificate is valid for development only
 - Verifying matching VMP signature in cache
 - Signature is valid [streaming, 2275 days of validity], use cached signature
  • signing         file=release/build/mac-arm64/App.app platform=darwin type=distribution identity=723761713BF30FC6C8F42202CA5C69F39C8678AA provisioningProfile=none
  • building block map  blockMapFile=release/build/App-0.9.4.dmg.blockmap
  • building block map  blockMapFile=release/build/App-0.9.4-mac.zip.blockmap
  • skipped macOS notarization  reason=`notarize` options were set explicitly `false`
  • building        target=macOS zip arch=arm64 file=release/build/App-0.9.4-arm64-mac.zip
  • building        target=DMG arch=arm64 file=release/build/App-0.9.4-arm64.dmg
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • Above command failed, retrying 5 more times
  • Above command failed, retrying 4 more times
  • Above command failed, retrying 3 more times
  • Above command failed, retrying 2 more times
  • Above command failed, retrying 1 more times
  • Above command failed, retrying 0 more times
  • building block map  blockMapFile=release/build/App-0.9.4-arm64-mac.zip.blockmap
  ⨯ hdiutil process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1  failedTask=build stackTrace=Error: hdiutil process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
    at ChildProcess.<anonymous> (/path/to/project/node_modules/builder-util/src/util.ts:252:14)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:303:5)
error Command failed with exit code 1.

I haven't specifically set the artifactName. but even when I do, e.g. to "${productName}-${version}-${arch}.${ext}", I get the same error.

The complete build config:

{
  "build": {
    "electronDownload": {
      "mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
    },
    "productName": "App",
    "appId": "com.example.App",
    "asar": true,
    "asarUnpack": "**\\*.{node,dll}",
    "files": [
      "dist",
      "node_modules",
      "package.json"
    ],
    "afterPack": ".erb/scripts/afterPack.js",
    "afterSign": ".erb/scripts/afterSign.js",
    "mac": {
      "target": {
        "target": "default",
        "arch": [
          "arm64",
          "x64"
        ]
      },
      "type": "distribution",
      "hardenedRuntime": true,
      "entitlements": "assets/entitlements.mac.plist",
      "entitlementsInherit": "assets/entitlements.mac.plist",
      "gatekeeperAssess": false,
      "notarize": false
    },
    "dmg": {
      "contents": [
        {
          "x": 130,
          "y": 150
        },
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "win": {
      "target": [
        "nsis"
      ]
    },
    "linux": {
      "target": [
        "AppImage"
      ],
      "category": "Development"
    },
    "directories": {
      "app": "release/app",
      "buildResources": "assets",
      "output": "release/build"
    },
    "extraResources": [
      "./assets/**"
    ]
  }
}

I have seen this issue: https://github.com/electron-userland/electron-builder/issues/7098 — but like I said, setting the output name explicitly does not help.

slhck commented 2 months ago

So, after messing around with dependencies I noticed that even a downgrade to the previous version did not fix the build. What solved it in the end was rebooting the Mac.

Leaving this here in case anyone else comes across such an error message.

wangwei10 commented 1 week ago

我想问一下 需要改什么东西吗 我也遇到了这个问题 但是有时候可以成功有时候不行