Runtime Error Uncaught (in promise): removeView was not found in ionic

I am using ionic version 3.15.2. Calling the below logout() method gives an error saying Runtime Error Uncaught (in promise): removeView was not found. I found similar questions in the Internet, but they had occurred for different reasons. What have I done wrong in my code?

home-menu.ts

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, AlertController, 
PopoverController } from 'ionic-angular';
import { AuthProvider } from '../../providers/auth/auth';

import { LoginPage } from '../login/login';


@IonicPage()
@Component({
  selector: 'page-home-menu',
templateUrl: 'home-menu.html',
})

export class HomeMenuPage {

constructor(public navCtrl: NavController, public navParams: NavParams, 
   public authData: AuthProvider,
   public alertCtrl: AlertController, private popoverCtrl: 
    PopoverController) {
}

ionViewDidLoad() {
  console.log('ionViewDidLoad HomeMenuPage');
}

logout(){
  this.authData.logoutUser()
 .then((user) => {
   let alert = this.alertCtrl.create({
    message: "You are logging out",
    buttons: [
      {
        text: "Ok",
        role: 'cancel',
        handler: () => {
          this.navCtrl.popToRoot();                  
        }
      }
    ]
  });
  alert.present();
}, (error) => {
  var errorMessage: string = error.message;
  let errorAlert = this.alertCtrl.create({
    message: errorMessage,
    buttons: [
      {
        text: "Ok",
        role: 'cancel'
      }
    ]
  });
  errorAlert.present();
 });
}

}

Error

Runtime Error Uncaught (in promise): removeView was not found in ionic 

Stack Trace

Error: Uncaught (in promise): removeView was not found
at c (http://localhost:8100/build/polyfills.js:3:13535)
at c (http://localhost:8100/build/polyfills.js:3:13221)
at http://localhost:8100/build/polyfills.js:3:14067
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4499:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888)
at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)
at o (http://localhost:8100/build/polyfills.js:3:2203)
at <anonymous>
1 Like

Did you find a solution?

Iā€™m having same issue using ionViewWillEnter and ionViewWillLeave

core.js:1449 ERROR Error: Uncaught (in promise): removeView was not found
    at c (polyfills.js:3)
    at c (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.js:4751)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)
    at e.invokeTask [as invoke] (polyfills.js:3)
    at p (polyfills.js:2)

Have No idea how to fix this and its freezing my app