0

please help me out I have been trying to find solution to this online but I have not been able to come up with any reasonable approach in trying to solve this problem. I am trying to use firebase to authenticate users but i keep get getting this error : Failed to compile. C:/Users/Derry-uk/Desktop/work space/projects/Mobile Apps/instagram/App.js
Module not found: Can't resolve 'firebase' in 'C:\Users\Derry-uk\Desktop\work space\projects\Mobile Apps\instagram'

this is my package.json file

    {
  "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-community/masked-view": "^0.1.10",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "expo": "~40.0.0",
    "expo-status-bar": "~1.0.3",
    "firebase": "7.9.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-dotenv": "^2.5.1",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-screens": "^2.17.1",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0"
  },
  "private": true
}

and this is my app.js file

   import React from 'react'
import 'react-native-gesture-handler'
import { NavigationContainer, StackActions } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import LandingScreen from './components/auth/Landing'
import config from './config'

import * as firebase from 'firebase'

// Initialize Firebase
const firebaseConfig = {
  apiKey: config.API_KEY,
  authDomain: config.AUTH_DOMAIN,
  projectId: config.PROJECT_ID,
  storageBucket: config.STORAGE_BUCKET,
  messagingSenderId: config.MESSAGING_SENDER_ID,
  appId: config.APP_ID,
  measurementId: config.MESSUREMENT_ID,
}

if (firebase.apps.lenght === 0) {
  firebase.initializeApp(firebaseConfig)
}

const stack = createStackNavigator()
export default function App() {
  return (
    <NavigationContainer>
      <stack.Navigator initialRouteName='Landing'>
        <stack.Screen
          name='Landing'
          component={LandingScreen}
          option={{ headerShown: false }}
        />
      </stack.Navigator>
    </NavigationContainer>
  )
}

i can figure out what the problem is help me out....

3
  • Asking some basics. did you run npm install in the project directory
    – vvs
    Feb 7, 2021 at 13:53
  • I ran expo install firebase....got the error, then I ran nom install firebase...still got the error
    – Derry Uk
    Feb 7, 2021 at 13:57
  • The exception message is very clear. Somehow the firebase install is not being found at runtime. I am not sure of project structure you have but I would suggest checking that the firebase module did install successfully. Usually you can find dependencies under the node_modules folder of your project
    – vvs
    Feb 8, 2021 at 14:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.