Trouble simulating first Ionic project

I’m just getting started with Ionic and while I’ve got my project working great in the browser with ionic serve, I cannot get it to work when running it in an Xcode simulator. The app loads up and it just shows a white screen. In the console, I see the error:

2021-07-25 19:23:18.751467-0400 App[44717:1140433] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/[REDACTED]/Library/Developer/CoreSimulator/Devices/[REDACTED]/data/Containers/Data/Application/[REDACTED]/Library/Cookies/[REDACTED].binarycookies
⚡️  Loading app at capacitor://localhost...
2021-07-25 19:23:19.182512-0400 App[44717:1140433] WF: === Starting WebFilter logging for process App
2021-07-25 19:23:19.182661-0400 App[44717:1140433] WF: _userSettingsForUser : (null)
2021-07-25 19:23:19.183084-0400 App[44717:1140433] WF: _WebFilterIsActive returning: NO
2021-07-25 19:23:19.814581-0400 App[44717:1140433] [Process] 0x7fe861010e20 - [pageProxyID=5, webPageID=6, PID=44743] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSCocoaErrorDomain, code = 260
⚡️  WebView failed provisional navigation
⚡️  Error: The file “index.html” couldn’t be opened because there is no such file.

I’m at a loss at what to do because I just started the project yesterday, it’s all very boilerplate, and it works in the browser fine.

I too have exactly the same issue.

Just to help others who may face this. This issue is resolved. Unfortunately for me, it was more of an RTFM issue (although better documentation by ionic/Capacitor teams wouldn’t hurt. The steps that I had missed were:

$ npm run build
$ sudo npx cap sync
$ sudo ionic capacitor copy ios

These were documented here https://capacitorjs.com/docs/basics/workflow

I was about to fire off a blistering PR to the capacitor docs about how irresponsible it is to recommend running anything involving Ionic development as superuser, but I looked and actually didn’t see a single instance of sudo in the page you linked, so I’ll vent my frustration here instead.

I’ve tilted at this particular windmill more times than Discourse cares to count. There is no justifiable reason for using sudo during Ionic development, and this can’t be a rule that one simply follows “most of the time”. You can and likely will break file permissions in such a way that (a) is hard to track and fix, (b) necessitating effectively always running everything as root. Please save yourself and everybody reading your advice hours of needless pain and frustration.