-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
First of all, I want to thank the author team for making such an amazing work!~
When I had a 5000 port service, vite preview did not detect the port occupation and executed the service as usual, but the service could not respond normally.
It took me a whole afternoon to find this problem. Later, I found that a function of MAC OS occupied port 5000, but Vite didn't give me the corresponding prompt, so I couldn't access Preview normally,
I am aware of this PR(#6300) and will be modifying ports 5000 to 4000, but I don't think this is a good solution to this problem. I am a newbie and I am sure there are many other newbies who have spent some time here as I have.
I try to use the "net" modules to check for port occupancy, and I find it works fine. But I can't say why. I would like to submit PR if possible.
Reproduction
https://github.com/dohooo/vite-reproduction
yarn
yarn anotherServer
yarn previewI think it should give me a corresponding prompt when I do yarn preview.
System Info
System:
OS: macOS 12.1
CPU: (10) arm64 Apple M1 Max
Memory: 30.22 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Browsers:
Chrome: 97.0.4692.71
Safari: 15.2
npmPackages:
@vitejs/plugin-react: ^1.0.7 => 1.1.4
vite: ^2.7.2 => 2.8.0-beta.2Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.