Ionic Serve- www/ files missing (404 error)
Found yourself in a pickle, haven’t you? You probably found this article by Googling something similar to the article title, which led you to a rabbit hole of negative StackOverflow questions, Github Issue trackers, Ionic Form posts and the occasional Google Groups Question.
The Rabbit hole
Just me? That’s fine. Every search led me to a dead-end list of suggestions:
Just run
ionic-doctor check
ionic-doctor check
,remove your node_modules
,Closing this issue due to broadness/lacking info/some-other-non-helpful-closing-reason
…
You’ve probably done everything that I did. Wanting to rip out your hair, reverting commits, changing branches, and not understanding what happened to cause the (seemingly random) issue…
Turns out (for me at least) this error was caused by using an ambiguous array type. So how did I come to this conclusion? I went through my app commit for the day, when the error started popping up (which only happens on a new ionic serve
session, it doesn’t occur when using live-reload
.
How to fix it?
It’s so simple, and it bothers me so much. Terminal didn’t output any useful error, according to it, everything was running peachy-keen.
Simply change your array definitions from:
arr: [] = [...]
to
arr: any[] = []
It’s really that simple. Make those changes, close ionic-serve
and relaunch it. If it was the same issue that I was having, your build will work this time. If not, it’s back to the rabbit hole for you.
Questions?
You can find me on:
- GitHub: https://github.com/bengejd/
- Medium: https://medium.com/@JordanBenge
Who am I? My name is Jordan Benge, I am a Software Developer who loves helping others and contributing to Open-Source. I’ve been working in the Ionic Framework since Ionic 1, and have tried to keep up to date on the latest and greatest when it comes to Hybrid Mobile App Development.