pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Error: spawn UNKNOWN

Open Atlas16A opened this issue 2 years ago • 5 comments

What version of pkg are you using?

5.7.0

What version of Node.js are you using?

16.14.2

What operating system are you using?

Windows

What CPU architecture are you using?

arm64

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

node16-win-arm64 and node14-win-arm64

Describe the Bug

All attempts to use pkg to package any js file lead to this single error, I have also created a simple hello world file to turn into an exe as a test with same results as my projects. A exe file is generated but completely unusable state.

I don't know if I'm just stupid and missed something or if pkg is just completely broken.

Expected Behavior

A exe should generate that logs hello world.

To Reproduce

Steps taken: create single file with console.log("hello world");

run command pkg -t node16-win-arm64 index.js (error occurs in both Git Bash and CMD and with both node14 and node16 have not tested others)

still get error

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

Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at spawn (node:child_process:700:9)
    at fabricate (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\lib-es5\fabricator.js:55:51)
    at fabricateTwice (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\lib-es5\fabricator.js:120:5)
    at MultiStream._queue (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\lib-es5\producer.js:266:68)
    at MultiStream._next (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\node_modules\multistream\index.js:86:12)
    at Meter.onEnd (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\node_modules\multistream\index.js:129:12)
    at Object.onceWrapper (node:events:645:28)
    at Meter.emit (node:events:526:28)
    at endReadableNT (node:internal/streams/readable:1345:12) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawn'
}

Atlas16A avatar Jun 21 '22 04:06 Atlas16A

I'm having this exactly issue when trying to target arm64 on a Windows machine

BennyH26 avatar Jun 30 '22 18:06 BennyH26

same problem here, does anyone know how to solve it?

jmrsnt avatar Jul 15 '22 16:07 jmrsnt

@Atlas16A try using pkg -t node16.16.0-win-x64 index.js, worked for me.

jmrsnt avatar Jul 15 '22 16:07 jmrsnt

same problem here, does anyone know how to solve it?

My problem was I was attempting to compile a native linux ARM executable on x86-64 architecture. Vercel documentation clearly states this is not possible. My workaround was to compile a linux x86-64 executable, then use qemu-user to run this under emulation in linux. Hope this helps.

BennyH26 avatar Jul 15 '22 16:07 BennyH26

Same problem My system is win-x86 When use pkg,will fetch linux-arm64 and win-arm64,but my system is x86,is the question? English is not good~~~

xiaozheng11 avatar Jul 31 '22 00:07 xiaozheng11

What version of pkg are you using?

5.7.0

What version of Node.js are you using?

16.14.2

What operating system are you using?

Windows

What CPU architecture are you using?

arm64

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

node16-win-arm64 and node14-win-arm64

Describe the Bug

All attempts to use pkg to package any js file lead to this single error, I have also created a simple hello world file to turn into an exe as a test with same results as my projects. A exe file is generated but completely unusable state.

I don't know if I'm just stupid and missed something or if pkg is just completely broken.

Expected Behavior

A exe should generate that logs hello world.

To Reproduce

Steps taken: create single file with console.log("hello world");

run command pkg -t node16-win-arm64 index.js (error occurs in both Git Bash and CMD and with both node14 and node16 have not tested others)

still get error

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

Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at spawn (node:child_process:700:9)
    at fabricate (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\lib-es5\fabricator.js:55:51)
    at fabricateTwice (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\lib-es5\fabricator.js:120:5)
    at MultiStream._queue (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\lib-es5\producer.js:266:68)
    at MultiStream._next (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\node_modules\multistream\index.js:86:12)
    at Meter.onEnd (C:\Users\tomsh\AppData\Roaming\nvm\v16.14.2\node_modules\pkg\node_modules\multistream\index.js:129:12)
    at Object.onceWrapper (node:events:645:28)
    at Meter.emit (node:events:526:28)
    at endReadableNT (node:internal/streams/readable:1345:12) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawn'
}

The source code needs to be copied and packaged on a computer with arm architecture

hkp4570 avatar Oct 25 '22 10:10 hkp4570

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] avatar Jan 24 '23 00:01 github-actions[bot]

Same.

BoryaGames avatar Jan 27 '23 19:01 BoryaGames

Seeing this on 5.8 on Parallels but unknown if it's a pkg issue

o0101 avatar Feb 07 '23 16:02 o0101

https://github.com/vercel/pkg#targets

try add options --no-bytecode --public-packages "*" --public

r3x5ur avatar Mar 26 '23 13:03 r3x5ur

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] avatar Jun 25 '23 00:06 github-actions[bot]

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

github-actions[bot] avatar Jul 01 '23 00:07 github-actions[bot]