Ionic firebase phone auth Cannot read property 'RecaptchaVerifier' of undefined

I am trying to use firebase phone auth in ionic 4 with invisible Recaptcha. I have set ReCaptcha properties to window object. But still getting the following error

TypeError: Cannot read property ‘RecaptchaVerifier’ of undefined

What has gone wrong? Thank you in advance

window.service.ts

 get windowRef(){
    return window;
 }

page.ts

constructor(public win :WindowService){}

 ngOnInit() {

   this.windowRef = this.win.windowRef; 
   this.windowRef.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', {
    'size': 'invisible',      // error on this line

  });
 }

send(){
    const appVerifier = this.windowRef.recaptchaVerifier;

    this.afauth.signInWithPhoneNumber("+XXXXXXXXXXXX", appVerifier).then(function (success) {

         // code sent  
}).catch(err =>{console.log(err})
}

.html

  <div id="recaptcha-container"></div>

Attempt 2

this.recaptchaVerifier =new firebase.auth.RecaptchaVerifier('sign-in-button', {
      'size': 'invisible',
      // same error
    });

Hi pratik,
These error occurred because you should not installed
google firebase tools.

1.If you are using angularfire command like
npm install firebase angularfire

This firebase not reccomend for firebase you should install explicitly cmd like

npm install -g firebase-tools