Using ionic serve localhost does not work, but external does

I’m using ionic version 3.9.2.
When I use ionic serve, http://localhost:8100/ gives me the following error:


Runtime Error
Cannot find module “…/home/home”


but accessing it from http://192.168.2.20:8100 works fine.

Even when I removed the import of the Home module, the error is still thrown when using localhost.

Any ideas?
Thanks!

If you are using VS Code, then press ctrl + left click it will take you to the class definition or module location. If that does not happen, then you have put the wrong path.

This doesn’t make any sense for an error displayed in the browser.

Sounds to me like something is cached for localhost:8100. Service worker active maybe?

Hi Sujan12. You’re right, I did uncomment the service worker code in the index.html file. However, commenting this back doesn’t seem to fix the problem. Is there some sort of cache I should clear?
Thanks!

Open dev tools, Application tab, Clear Storage, Uncheck everything but “Unregister service workers” I would say.

Awesome, that worked! You are a genius! Thanks a lot man, I would never have solved this without your help!

1 Like

Well, now you know how much time I spent to figure this out myself :stuck_out_tongue:

1 Like