question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make `vite preview` error-tolerant when the default port is in use

See original GitHub issue

Clear and concise description of the problem

It is said that the new AirPlay feature in macOS Monterey is using port 5000 and port 7000. https://developer.apple.com/forums/thread/682332.

In the current implementation, vite preview will straightly fail when port 5000 is in use. So it will fail by default in the new system.

Suggested solution

I don’t know if the default port of this new AirPlay feature will be changed in the future, as it’s not documented yet (in https://support.apple.com/en-us/HT202944). So I’m not proposing a change to the default port of vite preview.

But it should be error-tolerant. It should use the next available port when port 5000 is in use. It should still fail when the user specifies an unavailable port.

Alternative

No response

Additional context

No response

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ygj6commented, Jul 10, 2021

Great, I will submit a PR as soon as possible.

1reaction
ygj6commented, Jul 10, 2021

Coincidentally, I have a background service that also uses port 5050. If the port is occupied, it will automatically +1, which I think is very good. I am willing to contribute this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preview Options - Vite
Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not...
Read more >
vite preview - the preconfigured localhost:5000 responds with ...
When you change the port like vite preview --port 5001. Then it works. I checked everything. I don't have anything running on port...
Read more >
How to configure the CORS on the Vite server to remove the ...
You have to config the other side (the server which serves the image) to resolve it. or use a proxy server to add...
Read more >
List of TCP and UDP port numbers - Wikipedia
Port TCP UDP 1024 Reserved Reserved 1025 Yes Yes 1027 Reserved
Read more >
Quickstart: Deploy a Node.js service to Cloud Run
Note: If you installed the gcloud CLI previously, make sure you have the latest version by running gcloud components update . To set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found