Error on Local iOS build after updating from SDK 47 to SDK 48

Please provide the following:

  1. SDK Version: Expo SDK 48
  2. Platforms(Android/iOS/web/all): iOS

After migrating from SDK 47 to SDK 48 by following the official guide, my local build on a MacBook Pro M1 for iOS while running the command npx expo run:ios , every execution is returning the following errors after failing:

app/ios/Pods/Target Support Files/Pods-app/ExpoModulesProvider.swift:8:8)

   6 |  */
   7 | 
>  8 | import ExpoModulesCore
     |        ^ could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at: /Users/emmanueldadem/Library/Developer/Xcode/DerivedData/app-dyswmhrcweyfiybusnlyoknopvfn/Build/Products/Debug-iphonesimulator/ExpoModulesCore/ExpoModulesCore.swiftmodule
   9 | import EXAV
  10 | import EXCamera
  11 | import ExpoClipboard

I already ran $ expo doctor many times & all my dependencies are satisfying.

I am not sure if I missed something during the migration.

I already tried removing my package-lock.json / yarn.lock and node_modules and re-installing the dependencies many times, but unsuccessfully.

Here are my dependencies:

"dependencies": {
    "@expo/react-native-action-sheet": "^4.0.1",
    "@expo/vector-icons": "^13.0.0",
    "@manu_omg/react-native-emoji-selector": "^1.0.3",
    "@miblanchard/react-native-slider": "^2.1.0",
    "@react-native-async-storage/async-storage": "~1.17.11",
    "@react-native-community/datetimepicker": "6.5.2",
    "@react-native-community/netinfo": "9.3.5",
    "@react-native-community/slider": "4.2.4",
    "@react-navigation/bottom-tabs": "^6.2.0",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/stack": "^6.1.1",
    "@rneui/base": "^0.0.0-edge.2",
    "@rneui/themed": "^0.0.0-edge.2",
    "@sentry/react-native": "4.9.0",
    "@shopify/flash-list": "1.3.1",
    "axios": "^0.21.1",
    "deprecated-react-native-prop-types": "^2.3.0",
    "expo": "~47.0.3",
    "expo-application": "~5.0.1",
    "expo-asset": "~8.7.0",
    "expo-av": "~13.0.1",
    "expo-camera": "~13.1.0",
    "expo-clipboard": "~4.0.1",
    "expo-constants": "~14.0.2",
    "expo-dev-client": "~2.0.0",
    "expo-device": "~5.0.0",
    "expo-facebook": "~12.2.0",
    "expo-firebase-analytics": "~8.0.0",
    "expo-font": "~11.0.1",
    "expo-image-picker": "~14.0.1",
    "expo-keep-awake": "~11.0.1",
    "expo-linear-gradient": "~12.0.1",
    "expo-linking": "~3.3.1",
    "expo-localization": "~14.0.0",
    "expo-location": "~15.0.1",
    "expo-modules-core": "^1.2.6",
    "expo-notifications": "~0.17.0",
    "expo-secure-store": "~12.0.0",
    "expo-speech": "~11.0.0",
    "expo-splash-screen": "~0.17.4",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.4",
    "expo-video-thumbnails": "~7.0.0",
    "i18n-js": "^3.8.0",
    "jwt-decode": "^3.1.2",
    "link-preview-js": "^2.1.13",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "patch-package": "^6.5.0",
    "postinstall-postinstall": "^2.1.0",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.8",
    "react-native-3dcube-navigation": "^1.0.5",
    "react-native-agora": "^3.7.1",
    "react-native-animatable": "^1.3.3",
    "react-native-background-actions": "^2.6.5",
    "react-native-collapsible-tab-view": "^4.5.2",
    "react-native-deck-swiper": "^2.0.12",
    "react-native-draggable": "^3.3.0",
    "react-native-fast-image": "^8.6.3",
    "react-native-flash-message": "^0.3.1",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-image-crop-picker": "^0.38.1",
    "react-native-image-keyboard": "^2.2.0",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-loading-spinner-overlay": "^3.0.1",
    "react-native-mmkv": "~2.5.1",
    "react-native-modal": "^13.0.1",
    "react-native-modalbox": "^2.0.2",
    "react-native-modalize": "^2.1.1",
    "react-native-pager-view": "6.0.1",
    "react-native-paper": "^4.12.5",
    "react-native-parsed-text": "^0.0.22",
    "react-native-popover-view": "^5.1.7",
    "react-native-portalize": "^1.0.7",
    "react-native-progress-steps": "^1.3.4",
    "react-native-reanimated": "~2.12.0",
    "react-native-root-toast": "^3.4.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-share-menu": "^6.0.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-svg": "13.4.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-tab-view": "^3.3.0",
    "react-native-text-ticker": "^1.14.0",
    "react-native-timeago": "^0.5.0",
    "react-native-track-player": "^3.2.0",
    "react-native-video": "^5.2.1",
    "react-native-video-controls": "^2.8.1",
    "react-native-web": "~0.18.7",
    "react-native-webview": "11.23.1",
    "react-number-format": "^5.1.1",
    "react-redux": "^7.1.3",
    "redux": "^4.0.5",
    "rxjs": "^6.5.5",
    "sentry-expo": "~6.0.0",
    "socket.io-client": "^4.6.0",
    "url": "^0.11.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@types/lodash": "^4.14.179",
    "@types/react": "~18.0.24",
    "@types/react-native-snap-carousel": "^3.8.5",
    "@types/react-redux": "^7.1.7",
    "@types/socket.io-client": "^1.4.33",
    "babel-preset-expo": "~9.2.1",
    "jest-expo": "^47.0.0",
    "metro-minify-terser": "^0.66.2",
    "swagger-axios-codegen": "^0.11.16",
    "typescript": "^4.6.3"
  },

@wodin , @bacon , @kudochien .
Please, do you have any idea on how to solve this error ?

Hi @codingmotion

If you have not made any changes to code under the ios directory that you want to keep, try running npx prebuild --clean which will regenerate the ios and android native projects from scratch.

I’m not sure if it will fix the issues, but give it a go.

I am still facing the same issue after running this command.

Does it build for you if you remove ios and then run eas build -p ios --profile development?

If you create a new app with npx create-expo-app -t blank@sdk-47 and then copy the dependencies and devDependencies from the real app to the package.json of the new app, and then run npm install, does that build?

If I run npx expo-doctor with your dependencies, I get the following:

% npx expo-doctor
âś” Validating global prerequisites versions
âś” Checking for incompatible packages
âś” Checking for conflicting global packages in project
âś– Verifying prebuild support package versions are compatible
Issues:
  Expected package @expo/config-plugins@^5.0.2
  Found invalid:
    @expo/config-plugins@4.1.5
    (for more info, run: npm why @expo/config-plugins)
Advice:
  • Upgrade dependencies that are using the invalid package versions.
âś– Checking dependency versions for compatibility with the installed Expo SDK
Issues:
  Some dependencies are incompatible with the installed expo version:
    expo-modules-core@1.2.6 - expected version: ~1.0.4 || ~1.1.1
  Your project may not work correctly until you install the correct versions of the packages.
  Install individual packages by running npx expo install expo-modules-core@~1.0.4 || ~1.1.1
  Found outdated dependencies
Advice:
  • Use npx expo install --check to review and upgrade your dependencies.
âś” Validating Expo Config
âś– Checking package.json for common issues
Issues:
  The package "expo-modules-core" should not be installed directly in your project. It is a dependency of other Expo packages and should be installed automatically.

âś– Found one or more possible issues with the project. See above logs for issues and advice to resolve.

I see you have expo-modules-core installed. As expo-doctor says:

Issues:
  The package "expo-modules-core" should not be installed directly in your project. It is a dependency of other Expo packages and should be installed automatically.

So I uninstalled expo-modules-core.

If I re-run npx expo-doctor then it still complains about this:

Issues:
  Expected package @expo/config-plugins@^5.0.2
  Found invalid:
    @expo/config-plugins@4.1.5
    (for more info, run: npm why @expo/config-plugins)

Use npm why ... to check what’s causing the old version of @expo/config-plugins to be installed:

% npm why '@expo/config-plugins@4.1.5'
@expo/config-plugins@4.1.5
node_modules/expo-facebook/node_modules/@expo/config-plugins
  @expo/config-plugins@"^4.0.14" from expo-facebook@12.2.0
  node_modules/expo-facebook
    expo-facebook@"~12.2.0" from the root project

I see you have expo-facebook installed. This was deprecated in Expo SDK 45 and removed in Expo SDK 46:

:building_construction: Deprecations, renamings, and removals

The SDK 45 docs are no longer available on docs.expo.dev, but you can still find the facebook page here (although it’s not formatted nicely).

The relevant part is this:

Deprecated. This module will be removed in SDK 46. There will be no replacement that works with the classic build service (expo build) because the classic build service has been superseded by EAS Build. With EAS Build, you should use react-native-fbsdk-next instead.

So you will need to uninstall expo-facebook and then install react-native-fbsdk-next according to their documentation.

After that, try npx expo-doctor again. Assuming expo-doctor is no longer complaining about anything, try building.

I resolved all dependencies issues and the native iOS is now compiling successfully, so that the previous mentioned error disappeared.

But after the dev client is being started or also by running expo start --dev-client , I am now getting this error telling that my Root file may not be registered:

 LOG  Running "" with {"rootTag":1,"initialProps":{}}
 ERROR  Invariant Violation: "" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

Although it was working well in SDK 47.

Here is how my index.js file looks like:

import 'expo-dev-client';

import 'react-native-gesture-handler';
import 'react-native-image-keyboard';
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);

Do you get any other errors before that one?

As the “Application has not been registered” error page says:

What this error means

An exception may be preventing your app from registering itself

The most common cause of this error is that there is an exception thrown in your application before it’s able to register itself. When a React Native application loads, there are two steps:

  1. Load the JavaScript code, and if everything is successful, then your application will be registered. If there is any exception when loading the bundle then execution will be aborted and it will never reach the part where your application is registered.
  2. Run the registered application. If loading the code failed, then the application won’t be registered and you will see the error that is the subject of this page.

If you’re in this situation, the error message you’re seeing is a red herring, it’s distracting you from the real error that led to the application not being registered.

Look at your logs prior to this error message to see what may have caused it. A frequent cause is multiple versions of a native module dependency that registers itself as a view — for example this Stack Overflow thread where the poster has multiple versions of react-native-safe-area-context in their dependencies.

Then, I have a serious issue hidden somewhere in my code. Because there is no error before and above the previous exception (the red herring one). Bellow are my logs while starting the dev-client:

Logs for your project will appear below. Press Ctrl+C to exit.
› Opening on iOS...
› Opening exp+lettalk://expo-development-client/?url=http%3A%2F%2F172.18.148.174%3A8081 on iPhone 14 Pro
› Press ? │ show all commands
» android: sentry-expo: Sentry `authToken` found in app.json. Avoid committing this value to your repository, configure it through `SENTRY_AUTH_TOKEN` environment variable instead. See: https://docs.expo.dev/guides/using-sentry/#app-configuration
» ios: sentry-expo: Sentry `authToken` found in app.json. Avoid committing this value to your repository, configure it through `SENTRY_AUTH_TOKEN` environment variable instead. See: https://docs.expo.dev/guides/using-sentry/#app-configuration
» android: sentry-expo: Sentry `authToken` found in app.json. Avoid committing this value to your repository, configure it through `SENTRY_AUTH_TOKEN` environment variable instead. See: https://docs.expo.dev/guides/using-sentry/#app-configuration
» ios: sentry-expo: Sentry `authToken` found in app.json. Avoid committing this value to your repository, configure it through `SENTRY_AUTH_TOKEN` environment variable instead. See: https://docs.expo.dev/guides/using-sentry/#app-configuration
iOS Bundling complete 7347ms
 LOG  Running "" with {"rootTag":1,"initialProps":{}}
 ERROR  Invariant Violation: "" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

I am trying to log everything that may throw an error to check.

OK, then things get more tricky.

You might have to resort to expo.fyi/manual-debugging

I resolved it by removing this piece of code from my Podfile:

$RNFirebaseAsStaticFramework = true

And now everything compile and run fine without exceptions.

The previous piece of code has been added while migrating from Expo SDK 46 to > Expo SDK 47.

I also notice that is related to Firebase module : So are there any **deprecations** related to Firebase / Analytics within Expo SDK 48 ?

I’m glad you’ve got it working, however, if you removed something from your Podfile, it means you’re now on the Bare workflow and should keep that in mind going forward.

I don’t think you should need to be on the bare workflow, though.

I don’t personally use Firebase or analytics, but what I know about this off the top of my head is that the expo-firebase-analytics package should no longer be used in an Expo SDK 48 app (I think it was deprecated in SDK 45 and removed in 46 or maybe deprecated in 46 and removed in 47.) See expo.fyi/firebase-migration-guide

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.