vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.28k stars 1.01k forks source link

MacOS GitHub actions – Error: spawn Unknown system error -86 #2000

Closed steebchen closed 11 months ago

steebchen commented 11 months ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

v18.18.0

What operating system are you using?

MacOS M1 on GitHub

What CPU architecture are you using?

arm64 / Apple M1

What Node versions, OSs and CPU architectures are you building for?

node18-darwin-arm64

Describe the Bug

Build for MacOS arm64 fails:

node:internal/child_process:414
    throw errnoException(err, 'spawn');
    ^

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:414:11)
    at spawn (node:child_process:761:9)
    at fabricate (/Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/pkg/lib-es5/fabricator.js:55:51)
    at fabricateTwice (/Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/pkg/lib-es5/fabricator.js:120:5)
    at MultiStream._queue (/Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/pkg/lib-es5/producer.js:271:68)
    at MultiStream._next (/Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/multistream/index.js:86:12)
    at Meter.onEnd (/Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/multistream/index.js:129:12)
    at Object.onceWrapper (node:events:631:28)
    at Meter.emit (node:events:517:28)
    at endReadableNT (node:internal/streams/readable:1368:12) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

Full logs:

https://github.com/steebchen/prisma-client-go/actions/runs/6385650552/job/17330890459

Please note that these warnings:

> Warning Cannot resolve '`${paths2.prismaClient}/runtime/${engineType}`'
  /Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/prisma/build/index.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve '`${paths2.prismaClient}/generator-build/index.js`'
  /Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/prisma/build/index.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve 'mod'
  /Users/runner/work/prisma-client-go/prisma-client-go/binaries/build/node_modules/prisma/build/index.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.

don't seem to be related. They also appear when building locally on a real M1 Mac, but it builds successfully.

Expected Behavior

Build to succeed on M1 Mac on GitHub actions

To Reproduce

See

https://github.com/steebchen/prisma-client-go/blob/main/.github/workflows/publish-cli.yml

and

https://github.com/steebchen/prisma-client-go/blob/main/binaries/publish.sh

DrSkunk commented 11 months ago

I recently received the same error, but that was when I was building for arm64 on an Intel-based Mac. Can you double check the architecture with a temporary step command like uname -a?

steebchen commented 11 months ago

Indeed. I thought it was arm64...

+ uname -a
Darwin Mac-1696334212407.local 21.6.0 Darwin Kernel Version 21.6.0: Fri Sep 15 16:17:23 PDT 2023; root:xnu-8020.240.18.703.5~1/RELEASE_X86_64 x86_64
steebchen commented 11 months ago

It works on macos-13-xlarge. Their naming is a bit confusing... I guess you can close the issue as compiling arm64 on x64 doens't make sense?

DrSkunk commented 11 months ago

It may be interesting to throw a more specific error for this, since there isn't a lot of documentation about this online. Let me see if I can make a pull request showcasing this.