Anuj Goyal
Anuj Goyal

Reputation: 1

/src/firebase.js Module not found: Can't resolve 'firebase' in '/Users/anujgoyal/Desktop/reels/src'\?

image of the project and files

I am trying to import firebase in my react app, using the following syntax:

import firebase from "firebase";

But I am facing following issue:

./src/firebase.js

Module not found: Can't resolve 'firebase' in '/Users/Desktop/reels/src'

commands i have ran on terminal:

npm i firebase 

Also i have checked in the node modules firebase was there.

Upvotes: 0

Views: 325

Answers (2)

shihar
shihar

Reputation: 78

I think you're using the ^9 version, so try this:

import firebase from 'firebase/compat/app'

Upvotes: 1

muhammad awais
muhammad awais

Reputation: 11

You should try this code

import { initializeApp } from "firebase/app";
import { getFirestore } from "firebase/firestore";

Upvotes: 1

Related Questions