Search code examples
iosxcodecross-platformcapacitor

⚡️ TypeError: Module name, '@capacitor/splash-screen' does not resolve to a valid URL


When I create a capacitorjs project and add iOS and then open Xcode and click run it outputs an error in the Xcode output and shows a white screen. the web version of it works fine. I have modified zero code and just run

npx cap add ios
npx cap sync
npx cap open ios

and then run it from Xcode. It shows this error in the console

⚡️  ------ STARTUP JS ERROR ------

⚡️  TypeError: Module name, '@capacitor/splash-screen' does not resolve to a valid URL.
⚡️  URL: 
⚡️  [error] - {}
⚡️  :0:0

⚡️  See above for help with debugging blank-screen issues

I can get the app to display stuff if I remove all references of plugins from the code but that does not really help.

Update:

I gave up and instead of going through whatever their default framework is just using nextjs instead.


Solution

  • Run npm run build before sync

    npx cap add ios
    
    npm run build
    
    npx cap sync
    npx cap open ios
    

    Capacitor's documents don't mention it; I (an app developer) took too long to figure out this. :(