8

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.

Jonathan Southern
  • 1,121
  • 7
  • 22
Hassan Mahmud
  • 81
  • 1
  • 1
  • 3

5 Answers5

5
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

node_modules
  • 4,790
  • 6
  • 21
  • 37
Milán Nikolics
  • 503
  • 2
  • 5
  • 23
  • Which code editor or IDE use? My experinece about visual studio code sometimes stuck. I search the problem but not found. After reinstalled work evertyhing fine. – Milán Nikolics Dec 24 '20 at 13:09
  • 1
    I think wort it try reinstall. Yet happpened me that not find a file the correct path because behind the scenes visual studio code spolied this file reference(after file was renamed) – Milán Nikolics Dec 24 '20 at 19:07
  • Thanks for the msg. Tried it by reinstalling. Didn't work. I don't know, its just if there is any problem somewhere and I can't even find it. Kind of frustrating to be a newbie (•‿•) – Hassan Mahmud Dec 24 '20 at 20:49
2

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

Milán Nikolics
  • 503
  • 2
  • 5
  • 23
0
  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.
sarem eskandary
  • 504
  • 4
  • 16
0

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.

-1

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

Mounesh
  • 561
  • 5
  • 18