Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The preview mode doesn't correctly inform the user about port occupied. #6519

Closed
7 tasks done
dohooo opened this issue Jan 15, 2022 · 1 comment · Fixed by #8543
Closed
7 tasks done

The preview mode doesn't correctly inform the user about port occupied. #6519

dohooo opened this issue Jan 15, 2022 · 1 comment · Fixed by #8543
Labels
enhancement New feature or request

Comments

@dohooo
Copy link

dohooo commented Jan 15, 2022

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 preview

I 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.2

Used Package Manager

yarn

Logs

No response

Validations

@Niputi Niputi added the enhancement New feature or request label Jan 15, 2022
@dohooo
Copy link
Author

dohooo commented Jan 16, 2022

Can I check whether there are any ports occupied on localhost / 127.0.0.1 when detecting port occupancy? @Niputi

Would love to commit a PR

@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
2 participants