close

[Solved] TypeError: firebase.auth is not a function

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: firebase.auth is not a function in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: firebase.auth is not a function Error Occurs?

I am using firebase in my app. When I try to use firebase.auth() however I get an error.

console.js:32 TypeError: firebase.auth is not a function

How To Solve TypeError: firebase.auth is not a function Error?

  1. How To Solve TypeError: firebase.auth is not a function Error?

    To Solve TypeError: firebase.auth is not a function Error fixed this by deleting my node_modules directory and reinstalling everything. Also, I'm importing firebase like so.

  2. TypeError: firebase.auth is not a function

    To Solve TypeError: firebase.auth is not a function Error fixed this by deleting my node_modules directory and reinstalling everything. Also, I'm importing firebase like so.

Solution 1

fixed this by deleting my node_modules directory and reinstalling everything.

Also, I’m importing firebase like so:

import firebase from 'firebase'
require('firebase/auth')

Solution 2

The first time I installed the modules (this is when the auth object wasn’t appearing):

// this seems to confuse things with the auth object when installed in this order
$ npm install firebase-admin --save
$ npm install firebase --save

I deleted the npm folder and started from scratch although this time I reversed the installation order:

// for some reason this worked and now I can access the auth object
$ npm install firebase --save
$ npm install firebase-admin --save

I didn’t do anything else. I simply reversed the installation order by installing firebase first and firebase-admin second. I hope this works for other people.

Solution 3

just add > into your project.

import firebase from '@firebase/app';
require('firebase/auth');

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment