DEV Community

Cover image for localhost + service worker & caches = serve old app
Sarah Hassan
Sarah Hassan

Posted on

localhost + service worker & caches = serve old app

I will share with you an issue that occurred while I was developing a new app. When I try to open the new app with the localhost at the port 3000 it always opens the old app :(

You can imagine what I felt, stop the server, and then start again many times and I couldn't believe why the old app continuously appears???

I googled for a solution to kill that old app.

My Sincere friend StackOverflow help me, please then I found a solution. Open cmd and run netstat -ano | findstr :<PORT> and then a list will appear and you can kill it by run taskkill /PID <PID> /F

Wow, I killed it. let's try to open our new app in confidence. What???? No, the old app is still alive :(

I tried many other solutions but it is still alive!

Take a breathe and think and think again and suddenly I asked myself what weapons the old app had to beat me in this game?? The old app is a weather app with a manifest file and service worker and cachhhhe. I google again and found this solution. Now -a loud hahaha- I know how to kill it :D

Game over by Darius Dan Blue<br>
 from flaticon

Just by clearing storage from developer tools. What caused the issue is that chrome was loading cached files for the old app. So every time I tried to open at the port 3000 it was opened from caches.

Thanks for reading! If you meet a similar issue leave a comment and share how you did solve it.

Don't forget to follow me to get real programming problems that you may face and get solutions for them.

Hope this article helps, feel free to share it with your friends, any feedback will be appreciated :)

Top comments (2)

Collapse
 
ap211 profile image
Arjun Porwal

I didn't work in my case. Although, You can try this one if still facing this problem,

  1. Open Network Tab Image description
  2. Disable Cache for Once (Tick Disable Cache) Image description
  3. Reload the page (Hurrahhhh..........You got your current app 🥳🥳)

  4. Untick Disable Cache button
    Image description

Collapse
 
danielglejzner profile image
Daniel Glejzner

Hello there - thanks for joining and being helpful ! :)