firebase.firestore() is not a function when trying to initialize Cloud Firestore

前端 未结 21 1533
独厮守ぢ
独厮守ぢ 2020-12-01 02:45

When I try to initialize Firebase Cloud Firestore, I ran into the following error:

Uncaught TypeError: WEBPACK_IMPORTED_MODULE_0_firebase

21条回答
  •  清歌不尽
    2020-12-01 03:14

    In my case the problem was that I've accidentally added firebase-admin alongside with the firebase package in my package.json. And firebase-admin took precedence so even after adding the imports as per the accepted answer I was still getting the same error.

    Removing the redundant firebase-admin from the client app fixed the problem.

    As a note, firebase-admin is intended for server side to operate in admin mode, while the firebase package is a client side library.

提交回复
热议问题