Minolga Fox
Minolga Fox

Reputation: 1

Error: Package "@react-native-firebase/firestore" does not contain a valid config plugin and ERR_UNSUPPORTED_DIR_IMPORT in Expo project

I’m working on an Expo project using @react-native-firebase/firestore. When I run npx expo-doctor, I encounter the following errors:

  1. PluginError: Package "@react-native-firebase/firestore" does not contain a valid config plugin. Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin Unexpected token 'typeof'

  2. Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import error suggesting @react-native-firebase/app/lib/common/index.js.

Here’s what I’ve tried:

  1. Cleared the Expo cache using expo start -c to ensure no lingering issues.

  2. Performed a clean build using ./gradlew clean in the android directory, but this introduced additional errors.

  3. Downgraded Node.js from v22.12.0 to v18 to avoid compatibility issues, but this led to new errors.

  4. Verified Firebase dependencies (@react-native-firebase/app, @react-native-firebase/auth, and @react-native-firebase/firestore) were up-to-date and aligned with the documentation.

  5. Updated all dependencies and reinstalled them to ensure there were no mismatched versions.

    Despite these efforts, the issue persists.

> Task :expo-constants:createExpoConfig FAILED
/home/minolga/Development/Serenica/Frontend-root/Serenica/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js:126
        throw error;
        ^

SyntaxError: Unexpected token 'typeof'
    at compileSourceTextModule (node:internal/modules/esm/utils:338:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:437:12)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:390:33)
    at new ModuleJobSync (node:internal/modules/esm/module_job:341:34)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:413:11)
    at new ModuleJobSync (node:internal/modules/esm/module_job:341:34)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:326:11)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1414:24)
    at Module._compile (node:internal/modules/cjs/loader:1547:5) {
  name: 'PluginError',
  isPluginError: true,
  code: 'INVALID_PLUGIN_IMPORT',
  cause: undefined
}

Node.js v22.12.0

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo-constants:createExpoConfig'.
> Process 'command 'node'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 6s
22 actionable tasks: 5 executed, 17 up-to-date
Error: /home/minolga/Development/Serenica/Frontend-root/Serenica/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1
Error: /home/minolga/Development/Serenica/Frontend-root/Serenica/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1
    at ChildProcess.completionListener (/home/minolga/Development/Serenica/Frontend-root/Serenica/node_modules/@expo/spawn-async/src/spawnAsync.ts:67:13)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:303:5)
    ...
    at spawnAsync (/home/minolga/Development/Serenica/Frontend-root/Serenica/node_modules/@expo/spawn-async/src/spawnAsync.ts:28:21)
    at spawnGradleAsync (/home/minolga/Development/Serenica/Frontend-root/Serenica/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:134:28)
    at assembleAsync (/home/minolga/Development/Serenica/Frontend-root/Serenica/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:83:16)
    at runAndroidAsync (/home/minolga/Development/Serenica/Frontend-root/Serenica/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:48:24)

I also enabled verbose logging with EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS and EXPO_DEBUG, but the additional output hasn’t clarified the root cause.

Environment Details:

What’s next?
The project is in its early stages, so I haven’t yet created a minimal reproducible example. I’m hesitant to start over as this seems to be a rare and complex issue.

What else can I try to resolve these errors? Could this be related to Metro bundler or the Firebase dependencies? Are there any known compatibility issues between these libraries and Expo?

Upvotes: 0

Views: 180

Answers (1)

Smayan N
Smayan N

Reputation: 1

Make sure in your app.json, that you don't include @react-native-firebase/firestore as one of the plugins under expo. That fixed it for me.

Upvotes: 0

Related Questions