oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.26k stars 2.69k forks source link

macOS 15 (Sequoia) Beta: error when running Vite dev server #12527

Open walteh opened 2 months ago

walteh commented 2 months ago

What version of Bun is running?

1.1.18+5a0b93523

What platform is your computer?

Darwin 24.0.0 arm64 arm

What steps can reproduce the bug?

Use a mac with macOS 15 (Sequoia) installed

Follow the same steps as documented here: https://bun.sh/guides/ecosystem/vite

For the options, I selected React & Typescript + SWC

The problem shows up when you try to do: bunx --bun vite

What is the expected behavior?

I pulled this from another mac running the same vite and bun versions, but on a different os - Darwin 23.5.0 arm64 arm

➜  my-app git:(main) ✗ bunx --bun vite      

  VITE v5.3.3  ready in 368 ms

  ➜  Local:   https://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

What do you see instead?

➜  my-app git:(main) ✗ bunx --bun vite       
error when starting dev server:
ENAMETOOLONG: File name too long
    at readFile (native)
    at <anonymous> (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:46111:16)
    at readFileIfExists (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:46109:33)
    at <anonymous> (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:46103:5)
    at resolveHttpsConfig (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:46099:35)
    at <anonymous> (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:63051:30)
    at processTicksAndRejections (:12:39)

Additional information

The Vite version I am using is v5.3.3, which is just the latest stable as of today.

I thought it might be related to https://github.com/oven-sh/bun/issues/10356, but not sure. Strange that it shows up only on the Sequoia beta.

walteh commented 2 months ago

update, it remains an issue on

bun: 1.1.20+ae1948925 os: Darwin 24.0.0 arm64 arm / Version 15.0 Beta (24A5289h) - Sequoia Beta 3

walteh commented 1 month ago

update, it remains an issue on

bun: 1.1.21+70ca2b76c vite: 5.3.5 os: Darwin 24.1.0 arm64 arm / Version 15.1 Beta (24B5009l) - Sequoia

mattpilott commented 1 month ago

I've started seeing this issue too after removing nodejs, in an effort to solely use bun.

error when starting dev server:
ENAMETOOLONG: File name too long
    at readFile (native)
    at <anonymous> (/Users/Matt/Downloads/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:45485:16)
    at readFileIfExists (/Users/Matt/Downloads/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:45483:33)
    at <anonymous> (/Users/Matt/Downloads/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:45477:5)
    at resolveHttpsConfig (/Users/Matt/Downloads/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:45473:35)
    at <anonymous> (/Users/Matt/Downloads/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:62630:30)
    at processTicksAndRejections (:12:39)

bun: 1.1.24 vite: 5.4.0 os: 15.1 Beta (Dev 2) (24B5024e)

dmarcautan commented 1 week ago

os: MacOS Sonoma 14.6.1 arch: arm64 vite: 5.4.2 bun: 1.1.27

After tracing the issue it can be isolated to the following deviation. Whenever the filename that exceeds the max? length is passed to readFile() from "node:fs/promises" module bun throws immediate error but node instead returns a rejected promise.

Can be reproduced by running in bun and node the script:

const {readFile} = require("node:fs/promises");

const longFileName = "./" + "x".repeat(1024); 

readFile(longFileName).catch(() => console.log("Rejected promise"));
Jarred-Sumner commented 5 days ago

Oh interesting, it sounds like we need to wrap it in an exception handler that returns a Promise rejection