desktop / dugite

Elegant bindings for working with Git in your Node applications
MIT License
460 stars 149 forks source link

spawn Unknown system error -86 #576

Closed linonetwo closed 1 month ago

linonetwo commented 1 month ago

spawn Unknown system error -86 Error: spawn Unknown system error -86\n at ChildProcess.spawn (node:internal/child_process:421:11)\n at spawn (node:child_process:776:9)\n at execFile (node:child_process:351:17)\n at t. (node:electron/js2c/node_init:2:2955)\n at /Applications/TidGi.app/Contents/Resources/node_modules/dugite/lib/git-process.ts:200:40\n at new Promise ()\n at Function.execTask (/Applications/TidGi.app/Contents/Resources/node_modules/dugite/lib/git-process.ts:180:7)\n at Function.exec (/Applications/TidGi.app/Contents/Resources/node_modules/dugite/lib/git-process.ts:148:17)\n at Vt (/Applications/TidGi.app/Contents/Resources/app.asar.unpacked/.webpack/main/722.index.worker.js:2:405191)\n

https://github.com/desktop/dugite/blob/bccae05435eac01d4da7597c9a255a3696c7439f/lib/git-process.ts#L200-L210

            // DEBUG: console execOptions
            console.log(`execOptions`, execOptions);
            console.log(`Executing file: ${gitLocation} with arguments: ${args.join(' ')}`);

execOptions {
  cwd: '/Users/linonetwo/Desktop/wiki/wiki',
  encoding: 'utf8',
  maxBuffer: 10485760,
  env: {
    LOCAL_GIT_DIRECTORY: '/Applications/TidGi.app/Contents/Resources/node_modules/dugite/git',
    GIT_EXEC_PATH: '/Applications/TidGi.app/Contents/Resources/node_modules/dugite/git/libexec/git-core',
    GIT_TEMPLATE_DIR: '/Applications/TidGi.app/Contents/Resources/node_modules/dugite/git/share/git-core/templates'

Executing file: /Applications/TidGi.app/Contents/Resources/node_modules/dugite/git/bin/git with arguments: config --get branch.master.pushRemote

In electron packed.

Dev mode don't have this issue.

Electron Version: 31.1.0 Node Version: 20.14.0 Chromium Version: 126.0.6478.114 dugite": "2.7.1",

linonetwo commented 1 month ago

/Applications/TidGi.app/Contents/Resources/node_modules/dugite/git/libexec/git-core/git zsh: bad CPU type in executable: /Applications/TidGi.app/Contents/Resources/node_modules/dugite/git/libexec/git-core/git

linonetwo commented 1 month ago

Need to manually set npm_config_arch, for example


      - name: Install dependencies (x64)
        run: pnpm install
        env:
          npm_config_arch: darwin-x64
      - name: Make macOS (x64)
        run: pnpm run make:mac-x64
        env:
          APPLE_ID: ${{ secrets.APPLE_ID }}
          APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
          CI: true
          CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Install dependencies (arm64)
        run: pnpm install dugite
        env:
          npm_config_arch: darwin-arm64
      - name: Make macOS (arm64)
        run: pnpm run make:mac-arm
        env:
          APPLE_ID: ${{ secrets.APPLE_ID }}
          APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
          CI: true
          CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

seems Github Actions recently upgrade Apple from x86 to Mx chip, so the postinstalled git binary is for arm64.

Oh, so previously the arm64 build was buggy for me...

linonetwo commented 1 month ago

Also need to disable pnpm cache.