Description
All of a sudden, I'm encountering an error on both iOS and Android when running my React Native project. The error message states that the module @react-native-firebase/app/lib/internal/nativeModule
could not be found.
Error Message
Unable to resolve module @react-native-firebase/app/lib/internal/nativeModule from /Users/app/node_modules/@react-native-firebase/remote-config/lib/index.js: @react-native-firebase/app/lib/internal/nativeModule could not be found within the project or in these directories:
import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule';
Package.json
{
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@notifee/react-native": "^7.8.2",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-community/slider": "^4.5.2",
"@react-native-firebase/analytics": "^17.4.1",
"@react-native-firebase/app": "^17.4.1",
"@react-native-firebase/auth": "^17.4.1",
"@react-native-firebase/messaging": "^17.4.1",
"@react-native-firebase/remote-config": "^20.1.0",
"@react-native-google-signin/google-signin": "^9.0.2",
"@react-navigation/stack": "^6.3.16",
"query-string": "^9.0.0",
"react": "18.2.0",
"react-native": "0.71.16",
"react-native-gesture-handler": "2.9.0",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "2.14.4"
}
}
Build.gradle
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
googlePlayServicesAuthVersion = "18.0.0" // <--- use this version or newer
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath('com.google.gms:google-services:4.3.15')
}
}
Steps to Reproduce
- Run
npm install
oryarn install
(if applicable). - Start the React Native app using
react-native run-android
orreact-native run-ios
. - The app will build successfully, but when it starts, the error appears.
Expected Behavior
The app should build and run without module resolution errors.
Environment
- React Native version:
0.71.16
- React Native Firebase version:
17.4.1
- Package manager:
yarn
- Platform: iOS/Android
Additional Context
- I've tried clearing Metro Bundler cache using
yarn start --reset-cache
. - I've deleted
node_modules
andpackage-lock.json/yarn.lock
, then reinstalled dependencies. - The error persists across different machines.
Any guidance or fixes would be appreciated!