nksaraf / vinxi

The Full Stack JavaScript SDK
https://vinxi.vercel.app
MIT License
1.84k stars 74 forks source link

Can't finish production build with Bun #372

Closed qm3ster closed 1 week ago

qm3ster commented 1 week ago

Building for production with Bun causes EINVAL -22 in copy_file_range syscall when putting files into .output. (It doesn't just affect /public/favicon.ico, if I remove all of public it fails the same way on some cache-busted css file, etc.)

Versions:

OS: Ubuntu 24.04 Runtime: bun v1.1.27 (I tried older ones down to 1.0.30, the error is exactly the same) vinxi: v0.4.3 (installs vite v5.4.5)

How to replicate:

curl -fsSl https://bun.sh/install | bash -s "bun-v1.1.27"
bun create solid problem
cd problem
bun i
bun run build

Output:

$ bun create solid problem
◇  Is this a Solid-Start project?
│  Yes
│
◇  Which template would you like to use?
│  bare
│
◇  Use Typescript?
│  Yes
$ cd problem
$ bun i
$ bun run build
... Normal build with no warnings ...
⚙  Preparing app for bun...

 ERROR  { [EINVAL: Invalid argument]                               12:12:53 AM
  code: 'EINVAL',
  path: '/home/user/project/.output/public/favicon.ico',
  syscall: 'copy_file_range',
  errno: -22 } 
qm3ster commented 1 week ago
⚙  Preparing app for bun...
[pid 120725] access("/home/u/p/.output/server", F_OK) = -1 ENOENT (No such file or directory)
[pid 120725] access("/home/u/p/.output/public", F_OK) = 0
[pid 120759] unlinkat(AT_FDCWD</home/u/p>, "/home/u/p/.output/public", 0) = -1 EISDIR (Is a directory)
[pid 120759] openat(AT_FDCWD</home/u/p>, "/home/u/p/.output/public", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 15</home/u/p/.output/public>
[pid 120759] unlinkat(15</home/u/p/.output/public>, "favicon.ico", 0) = 0
[pid 120759] unlinkat(AT_FDCWD</home/u/p>, "/home/u/p/.output/public", AT_REMOVEDIR) = 0
[pid 120755] mkdir("/home/u/p/.output/public", 0777) = 0
[pid 120757] stat("/home/u/p/public", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
[pid 120725] stat("/home/u/p/public", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
[pid 120756] stat("/home/u/p/public/**", 0xa6bcd79d810) = -1 ENOENT (No such file or directory)
[pid 120759] openat(AT_FDCWD</home/u/p>, "/home/u/p/public", O_RDONLY|O_DIRECTORY) = 15</home/u/p/public>
[pid 120725] access("/home/u/p/.output/public/favicon.ico", F_OK) = -1 ENOENT (No such file or directory)
[pid 120755] lstat("/home/u/p/public/favicon.ico", {st_mode=S_IFREG|0664, st_size=664, ...}) = 0
[pid 120755] openat(AT_FDCWD</home/u/p>, "/home/u/p/public/favicon.ico", O_RDONLY|O_NOFOLLOW) = 15</home/u/p/public/favicon.ico>
[pid 120755] openat(AT_FDCWD</home/u/p>, "/home/u/p/.output/public/favicon.ico", O_WRONLY|O_CREAT, 0666) = 19</home/u/p/.output/public/favicon.ico>
[pid 120755] copy_file_range(15</home/u/p/public/favicon.ico>, [0], 19</home/u/p/.output/public/favicon.ico>, [0], 664, 0) = -1 EINVAL (Invalid argument)

 ERROR  { [EINVAL: Invalid argument]                                                                                                           1:16:26 AM
  code: 'EINVAL',
  path: '/home/u/p/.output/public/favicon.ico',
  syscall: 'copy_file_range',
  errno: -22 } 

I must be an idiot, because I see nothing wrong happening (up until the error) :horse:

qm3ster commented 1 week ago

It was ecryptfs (old encrypted home on ubuntu)

qm3ster commented 1 week ago

BUN_CONFIG_DISABLE_COPY_FILE_RANGE=true helps