Skip to content

Error with @react-native-firebase/auth and Expo: "does not contain a valid config plugin" #5629

Closed
@Madhav-Malhotra

Description

@Madhav-Malhotra

I'm trying to add @react-native-firebase/auth to a standard Expo template. I have followed all instructions in the documentation here. But I get this error:

Package "@react-native-firebase/auth" does not contain a valid config plugin.
Learn more: https://docs.expo.io/guides/config-plugins/#creating-a-plugin

Cannot use import statement outside a module

Steps to Reproduce

  1. Install Expo CLI and initialise a template project. When it asks for the type of template, just hit Enter to select the default Javascript app with one screen.
npm i -g expo
expo init my-project
cd ./my-project
  1. Install @react-native-firebase/app and @react-native-firebase/auth
    npm i @react-native-firebase/app @react-native-firebase/auth

  2. Create a Firebase project and add an Android app and an IOS app. Download config files for both (google-services.json and GoogleService-Info.plist). Place these files in the root folder (./my-project)

  3. Add the specified app.json configuration from the documentation.

{
  "expo": {
    "android": {
      "googleServicesFile": "./google-services.json"
    },
    "ios": {
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/auth"
    ]
  }
}
  1. Prebuild the app, starting with Android.
    expo run:android

You should see the error pop up.

Package "@react-native-firebase/auth" does not contain a valid config plugin.
Learn more: https://docs.expo.io/guides/config-plugins/#creating-a-plugin

Cannot use import statement outside a module

Here are my package versions

Package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-firebase/app": "^12.7.1",
    "@react-native-firebase/auth": "^12.7.1",
    "expo": "~42.0.1",
    "expo-status-bar": "~1.0.4",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0"
  },
  "private": true
}

app.json

{
  "expo": {
    "name": "sprint-tracker",
    "slug": "sprint-tracker",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "googleServicesFile": "./google-services.json"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/auth"
    ]
  }
}

I have node v14.17.4

What I've tried to debug

  • I've tried downgrading @react-native-firebase/app and @react-native-firebase/app to ^12.6.1
  • I've tried deleting the entire ./my-project folder and initialising a new app
  • I also saw the same error message in a forum about react-native-vision-camera. Someone commented how there was an issue with Expo 41 and 42. It said to modify the 'user podfile'. I'm just trying react-native-firebase for the first time, so I don't understand what they mean :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions