Skip to content

workaround for EACCESS / EPERM when bundled for single-file-executable#12

Merged
AlbertShown merged 2 commits intowebui-dev:mainfrom
xwxfox:patch-1
Dec 29, 2025
Merged

workaround for EACCESS / EPERM when bundled for single-file-executable#12
AlbertShown merged 2 commits intowebui-dev:mainfrom
xwxfox:patch-1

Conversation

@xwxfox
Copy link
Copy Markdown
Contributor

@xwxfox xwxfox commented Dec 27, 2025

When i was playing around with the library myself i constantly ran into errors like below when running it in a compiled single-file-executable.

permission denied, mkdir '/$bunfs'
    path: "/$bunfs",
 syscall: "mkdir",
   errno: -13,
    code: "EACCES"
)

It seems to be bacause of the way bun's virtual fs paths are returned - and it could def be fixed in a cleaner way, but this does work as a temporary workaround.

All it does is detect $bunfs in the function that returns the currentModulePath - and instead makes it fallback to path.resolve(process.cwd(), "vfs")

I've tested it myself, and it works in single-file-executables.

sysinfo in case it matters later, tested on:
Bun v1.3.6-canary.22+3898ed5e3
Arch Linux x64 (Linux 6.17.7-zen)

@AlbertShown AlbertShown merged commit 917e216 into webui-dev:main Dec 29, 2025
@AlbertShown
Copy link
Copy Markdown
Member

Thank you Jay 👍

Similar issue here #9, but we are looking for a way to embed dynamic libraries (.dll, .dynlib, .so) into single-file-executable.

@xwxfox
Copy link
Copy Markdown
Contributor Author

xwxfox commented Dec 29, 2025

Thank you Jay 👍

Similar issue here #9, but we are looking for a way to embed dynamic libraries (.dll, .dynlib, .so) into single-file-executable.

I've actually been working on something for this myself, once I get it more stable I'd love to share some more info :3

@Dialga
Copy link
Copy Markdown

Dialga commented Jan 10, 2026

Doesn't work:

$ bun build --compile .
   [5ms]  bundle  6 modules
  [40ms] compile  index
$ ./index
55 |     if (directory.startsWith("/")) {
56 |       directory = directory.slice(1);
57 |     }
58 |     directory = directory.replaceAll("/", "\\");
59 |   }
60 |     directory = resolve(homedir(), ".bun-webui");
                            ^
ReferenceError: resolve is not defined
      at <anonymous> (/$bunfs/root/.:60:24)
      at /$bunfs/root/.:75:3

Bun v1.3.5 (Linux x64)

@AlbertShown
Copy link
Copy Markdown
Member

Error is : resolve is not defined.

I think we should just import it like this:

import { homedir } from "node:os";
import { resolve } from "node:path";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants