bun
bun copied to clipboard
`Bun.spawn[Sync]()` not working (on WSL)
What version of Bun is running?
0.3.0 / 0.3.1 --canary
What platform is your computer?
Linux 4.4.0-17763-Microsoft x86_64 x86_64
What steps can reproduce the bug?
$ cat test.js
const { stdout } = Bun.spawnSync({
cmd: ["bun", "-v"],
stdout: "pipe",
});
console.log(stdout?.toString());
What is the expected behavior?
$ bun test.js
0.3.1
$
What do you see instead?
$ bun test.js
1 | const { stdout } = Bun.spawnSync({
cmd: ["bun", "-v"],
stdout: "pipe"
});
^
ENOSYS: Function not implemented
syscall: "open"
errno: -38
Additional information
Also tried Bun.spawn() and various examples under README.md to no avail.
I think this is a Linux kernel version issue. Bun uses features from Linux kernel 5.3 or so (pidfd)
You can upgrade to a later Linux kernel via Windows Update
Looks like I can't change/upgrade the Linux kernel on WSL v1 😅
Will test out WSL v2 and report back.
Happen with Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-208-generic x86_64) and Bun 0.5.9
The Linux kernel must be >= 5.13 or so due to using pidfd https://man7.org/linux/man-pages/man2/pidfd_open.2.html
I have the same issue with 4.15.0-200-generic so kernel upgrade needed. Just not fun on production server.
Apparently Vercel uses a similar runtime, seeing:
ENOSYS: Function not implemented
--
syscall: "open"
errno: -38
at /vercel/path0/scripts/smesc.ts:26:2
at processTicksAndRejections (:1:2602)
Apparently Vercel uses a similar runtime, seeing:
Yes, I get the following when running Bun.build() using v1.0.2 on Vercel just now
error: "pidfd_open(2)" system call is not supported by your Linux kernel
To fix this error, either:
- Upgrade your Linux kernel to a newer version (current: 5.10.186-frame descriptor�Hea)
- Ensure the seccomp filter allows "pidfd_open"
at node:child_process:171:46
at node:child_process:214:44
at /vercel/path0/scripts/build-browser-bun.js:65:0
at globalThis (/vercel/path0/scripts/build-browser-bun.js:359:12)
Duplicate of #5803