localhost:3000 (React, Next.js, Express): not working and fixes
Port 3000 is the default for React, Next.js, Express, Rails and Grafana. How to open it, and fix refused to connect and port in use.
Open this address: http://localhost:3000This opens on your own computer. It only works if the program is running.
localhost:3000 is the address of an app running on port 3000 of your own computer. It is the default port for React, Next.js, Express and Rails, so when it will not open, the app is usually not running yet.
What runs on localhost:3000
- React (Create React App) with
npm start - Next.js with
npm run dev - Node / Express apps that call
app.listen(3000) - Ruby on Rails with
rails server - Grafana, which uses 3000 by default
Commands to start and test port 3000
npm startnpm run devrails serverPORT=3001 npm start$env:PORT=3001; npm startFind what is using port 3000
Run these in a terminal on your computer. Nothing is sent to this site.
If localhost:3000 will not open
- EADDRINUSE: address already in use :::3000
- Another program, often an old dev server in a forgotten terminal, is on port 3000. Find it with the tool below and stop it, or start yours on another port.
- Cannot GET /
- Your Express app is running but has no route for /. Add
app.get("/", ...)or open a route that exists. - This site can’t be reached (ERR_CONNECTION_REFUSED)
- The server is not running. Start it and keep that terminal open. See the full checklist.
- Works on your computer, not on your phone
- Start the server on all network addresses and use your computer’s IP address. See how to open localhost from your phone.
- Something is already running on port 3000
- Create React App asks whether to use another port. Answer yes, or stop the old process. In Next.js,
npx next dev -p 3001uses a different port. - Cannot find module or missing scripts
- Run
npm installin the folder that has package.json, thennpm run devornpm start. Read which script name your package.json defines. - Blank page and no error
- Open the browser console (F12) and read the first error. Then check the terminal. A crash in the terminal shows the real cause.
- Vite and some new templates use 5173, not 3000
- If nothing is on 3000, read the address your terminal prints. Newer Vite projects use port 5173.
- Grafana asks for a login
- Grafana’s default user is admin with the password admin, and it asks you to change the password after the first login. Change it before exposing the port.
- Docker: nothing at localhost:3000
- Publish the port with
-p 3000:3000and make the app listen on 0.0.0.0, not only on 127.0.0.1 inside the container. - localhost works in one tool but not another
- localhost can resolve to the IPv6 address
::1or the IPv4 address127.0.0.1. If a server listens on only one of them, the other fails. Tryhttp://127.0.0.1:PORTandhttp://[::1]:PORT. If one works, start the server on the address you need or use that address.
Other ports like 3000
| Port | Usually used by |
|---|---|
| localhost:5173 | Vite dev server |
| localhost:4200 | Angular dev server |
| localhost:5000 | Flask |
| localhost:8000 | Django, PHP, Python |
| localhost:8080 | Tomcat, Spring Boot, Docker |
| localhost:8888 | Jupyter Notebook |
| localhost:9000 | PHP-FPM, SonarQube |
Questions about localhost:3000
- What runs on localhost:3000?
- Most often a React, Next.js, Express or Rails development server, or Grafana. The terminal where you started it shows which one.
- How do I change the port from 3000?
- Set the PORT variable when you start the app, for example PORT=3001 npm start, or change app.listen(3000) in your Express code.