Skip to content

Don't crash Metro when the Rozenite panel port 8071 is already in use - #29

Merged
retyui merged 2 commits into
retyui:mainfrom
Mohamed-kassim:fix/rozenite-port-in-use
Oct 14, 2026
Merged

retyui merged 2 commits into
retyui:mainfrom
Mohamed-kassim:fix/rozenite-port-in-use

Conversation

@Mohamed-kassim

Copy link
Copy Markdown
Contributor

Fixes #28.

With two Metro servers running at once (we run one per git worktree), the second one crashed on start because the Rozenite panel server always listens on 8071 and nothing handled the 'error' event from listen().

So runServer() now handles that event: on EADDRINUSE it prints a warning and Metro keeps running without its own panel server. Any other listen error gets a warning too, and a rejected createServer() no longer turns into an unhandled rejection.

[bundle-discovery] Port 8071 is already in use, probably by another Metro. The Bundle Discovery panel will show that server's bundle, not this one.

I tested the built plugin with 8071 held by a running Metro: it returned the config, printed the warning, and the process was still alive 8 seconds later. Before the change the same setup exited in about a second. yarn biome check, typecheck and build pass for the package, and there's a patch changeset.

The port itself stays hard-coded, because public/index.html points its iframe at http://localhost:8071. Making it configurable would mean telling the panel the port, which felt like a separate change. I put the port in a SERVER_PORT constant with a note about index.html so the two stay in sync.

Comment thread packages/rozenite-plugin/src/react-native.ts Outdated

@retyui retyui left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for PR , left small comment

@retyui
retyui merged commit c3679d5 into retyui:main Oct 14, 2026
1 check passed
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.

Rozenite plugin: second Metro crashes with EADDRINUSE on port 8071

3 participants