Hassan Mahmud
Hassan Mahmud

Reputation: 109

localhost:3000 is not working in the browser

Backend: Express server, with npx create-express-api backend

Frontend: Next.js, with npx create-react-app frontend

I have implemented these command in my root folder and trying to run npm start xxx to check if they are still working or not. But they are not working in my http://localhost:3000 Though they are working in this link http://172.27.178.192:3000 (on my network) This is the image showing the problem

I have changed browsers and still the same problem is appearing. On the browser it says Unable to connect Firefox can’t establish a connection to the server at localhost:3000.

Upvotes: 10

Views: 58424

Answers (6)

Archimedes Trajano
Archimedes Trajano

Reputation: 41290

In my case, Waterfox/Firefox was configured to disable IPV6 in about:config

network.dns.disableIPv6

Once I set it back to false which is the default it works. It is likely that localhost is mapped to ::1

Upvotes: 0

Wayne Nguyen
Wayne Nguyen

Reputation: 1

If you still have this problem and none of the above helps. Try my solution. I used http-proxy-middleware and deleted setupProxy.js -> npm start -> restore proxy, and it worked like a champ.

Upvotes: -1

Milán Nikolics
Milán Nikolics

Reputation: 621

netstat -ano | findstr :8080

Then the PID will appear at the right which you can kill with taskkill.

The last number the pid. enter image description here

then:

taskkill/pid 11704 /F

How to close TCP and UDP ports via windows command line

Upvotes: 8

Mounesh
Mounesh

Reputation: 744

It worked for me

  1. Delete the .next folder ( if your working on nextjs ) and try npm run dev command OR

  2. Move the project to another folder location OR

  3. Take back up of the code and delete the project and then run the same project again

  4. You can try all of the above also

Upvotes: -1

sarem eskandary
sarem eskandary

Reputation: 550

  1. in browser history search for localhost:3000 and delete all of them.
  2. make sure you closed all terminalls(check vscode too) and all tabs in your browsers.
  3. in new widnows terminal npx kill-port 3000 do it in WSL2 terminall too.
  4. make sure your firewall is turn of.
  5. restart you computer.

Upvotes: 0

Milán Nikolics
Milán Nikolics

Reputation: 621

I think some other application occupied your 3000 port. try find which one is. If you have found then closed and try again.

For instance you want to free the port 3000 Then, follow these commands.

netstat -ano taskkill /f /im [PID of the port 3000 got from previous command]

How to close TCP and UDP ports via windows command line

Upvotes: 2

Related Questions