-1

I'm trying to build an Ionic React project. I’m successfully compiling the project on the IOS simulator but It crashes when It opens. Error showing is

⚡️ ERROR: Unable to load public/index.html
⚡️ This file is the root of your web app and must exist before
⚡️ Capacitor can run. Ensure you’ve run capacitor copy at least
⚡️ or, if embedding, that this directory exists as a resource directory.

I have posted on ionic forum as well, Discussion Here

Nooruddin Lakhani
  • 7,507
  • 2
  • 19
  • 39

1 Answers1

2

That means the app is not able to find the index.html file in the public folder.

If you run npx cap open ios it should open your Capacitor project in Xcode. There you should see a blue folder called public with the index.html on it.

If you don't see it, then first run npm run build and then npx cap copy.

If you still don't see it, check that the value of webDir in capacitor.config.json matches the folder to where react is building your app.

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176