You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3000 is too common. It's the default port for a lot of node apps and if the user needs to locally run their API (on port 3000) and use live server to host their client side that makes calls to the API, there will be a non-zero amount of times where they start live server first, it takes 3000 and then their API fails to start because we've taken it.
AFAICT, the default port of Live Preview doesn't need to be 3000. It can be anything... so maybe we go with a larger, more random number and go from there? Like 31545.
there will be a non-zero amount of times where they start live server first, it takes 3000 and then their API fails to start because we've taken it.
This is quite an old issue, although I'm giving this a bit more thought. If it's a conflict with a user API, they can set the default port to be something else (which is a one-time change). Keeping it as 3000 makes it easy to remember, which comes in handy if the commands to open the preview ever fail.
I will close this for now, unless there are any other reasons not to use 3000. The process of changing the default port is not too tricky and I expect that anyone running something that doesn't have a fallback port should be able to set the live preview default port to something else.
Testing microsoft/vscode#158835
3000 is too common. It's the default port for a lot of node apps and if the user needs to locally run their API (on port 3000) and use live server to host their client side that makes calls to the API, there will be a non-zero amount of times where they start live server first, it takes 3000 and then their API fails to start because we've taken it.
AFAICT, the default port of Live Preview doesn't need to be 3000. It can be anything... so maybe we go with a larger, more random number and go from there? Like 31545.
Another thing to explore is asking for port 0 which will return a random unused port:
https://stackoverflow.com/questions/948122/get-a-random-high-port-number-that-is-still-available#:~:text=Assigning%20random%20ports%20is%20already%20part%20of%20the,port%20number%20will%20be%20still%20available.%20%E2%80%93%20PSkocik
The text was updated successfully, but these errors were encountered: