bun icon indicating copy to clipboard operation
bun copied to clipboard

macOS cannot run `bun run` with HTTP Serve

Open dalisoft opened this issue 2 years ago • 1 comments

What version of Bun is running?

0.3.0

What platform is your computer?

Darwin 22.2.0 x86_64 i386

What steps can reproduce the bug?

Download https://github.com/nanoexpress/static-serve-benchmark/blob/master/src/bun.js and run bun run --hot bun.js on macOS

What is the expected behavior?

Running HTTP Serve

What do you see instead?

❯ bun run src/bun.js
12 |       if(typeof entryNamespace?.default?.fetch === 'function')  {
13 |         Bun.serve(entryNamespace.default);
14 |       }
15 |    }, reportError);
16 | } else if (typeof entryNamespace?.default?.fetch === 'function') {
17 |    Bun.serve(entryNamespace.default);
       ^
error: Failed to start server. Is port 5000 in use?
      at bun:main:17:3

Additional information

Other my issues: #1655, #1654

dalisoft avatar Dec 24 '22 12:12 dalisoft

Hello!

This is a know "error" in MacOs Monterey and beyond.

MacOs runs an Airplay server that uses port 5000.

You have two solutions:

  1. Change the port used in your bun application
  2. Disable the Airplay server in your system preferences that runs on port 5000.

You can see more informations here: https://nono.ma/port-5000-used-by-control-center-in-macos-controlce

AmFlint avatar Dec 25 '22 20:12 AmFlint

@AmFlint Thank you, sorry, i didn't noticed or searched for it. Used port 4400 and it worked

dalisoft avatar Dec 28 '22 17:12 dalisoft

I had the same problem a few months ago haha

AmFlint avatar Dec 28 '22 17:12 AmFlint