I am using WSL2 (Ubuntu) to develop a React application built using Vite. When running the npm run dev command, the terminal reports that the server is running on localhost:8080, but:
- When trying to open http://localhost:8080 everything works in the Windows browser.
- However, inside WSL, for example, when executing curl http://localhost:8080 or netstat -nltp, it can be seen that port 8080 is not listening.
- Also, checking through lsof -i :8080 does not show any active processes.
- Third-party tools (netstat, lsof) do not detect that Vite is listening on port 8080.
- I made sure that npm run dev actually runs Vite with the --port 8080 flag.
- I tried to run the server with the --host flag, that is:vite --port 8080 --host 0.0.0.0 — did not help.
- I installed net-tools and checked the ports manually.
- I use the standard package.json, there are no custom Vite configs yet.
My goal is to ensure that port 8080 is actually listened to and accessible inside WSL2 (for example, via curl http://localhost:8080 ).