Runtime Error Object prototype may only be an Object or null: undefined


#1

I try to run my ionic application and then I got this error.

Runtime Error Object prototype may only be an Object or null: undefined

TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at __extends (http://localhost:8100/build/vendor.js:78206:9)
    at http://localhost:8100/build/vendor.js:78303:5
    at Object.<anonymous> (http://localhost:8100/build/vendor.js:78308:2)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at Object.268 (http://localhost:8100/build/main.js:58:79)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at Object.263 (http://localhost:8100/build/main.js:43:70)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at webpackJsonpCallback (http://localhost:8100/build/vendor.js:26:23)

this my environment:-

Ionic Framework: 3.7.1

Ionic App Scripts: 3.0.1

Angular Core: 4.4.3

Angular Compiler CLI: 4.4.3

Node: 6.11.4

I tried to solve this problem by uninstalling npm, ionic, all cordova plugins and reinstall them.

the big problem is I cannot understand where is the error and what is the part which makes this error !!??

My Package.json

 {
  "name": "HC-Mall",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/core": "4.3.2",
    "@ionic-native/splash-screen": "4.3.2",
    "@ionic-native/status-bar": "4.3.2",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.7.1",
    "ionicons": "3.0.0",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18",
    "cordova-plugin-ionic-webview": "^1.1.11",
    "cordova-plugin-ionic": "~2.0.1",
    "com.telerik.plugins.nativepagetransitions": "~0.6.5",
    "cordova-plugin-console": "~1.1.0",
    "cordova-plugin-device": "~1.1.4",
    "cordova-plugin-facebook4": "~1.9.1",
    "cordova-plugin-inappbrowser": "~1.7.1",
    "cordova-plugin-splashscreen": "~4.0.3",
    "cordova-plugin-statusbar": "~2.2.3",
    "cordova-plugin-whitelist": "~1.3.1",
    "cordova-plugin-x-socialsharing": "~5.2.1",
    "ionic-plugin-keyboard": "~2.2.1",
    "phonegap-plugin-push": "~2.1.0",
    "cordova-android": "~6.3.0"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.0.1",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-ionic": {
        "APP_ID": "abcd1234",
        "CHANNEL_NAME": "Master",
        "UPDATE_METHOD": "auto",
        "locator": "phonegap-plugin-push"
      },
      "com.telerik.plugins.nativepagetransitions": {},
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "119928665301467",
        "APP_NAME": "myApplication"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-x-socialsharing": {},
      "ionic-plugin-keyboard": {},
      "phonegap-plugin-push": {},
      "cordova-plugin-ionic-webview": {}
    },
    "platforms": [
      "android"
    ]
  }
}

My config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>MyApp</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
        <resource-file src="google-services.json" target="google-services.json" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
        <resource-file src="GoogleService-Info.plist" />
    </platform>
    <engine name="android" spec="~6.3.0" />
    <plugin name="cordova-plugin-ionic" spec="~2.0.1">
        <variable name="APP_ID" value="abcd1234" />
        <variable name="CHANNEL_NAME" value="Master" />
        <variable name="UPDATE_METHOD" value="auto" />
    </plugin>
    <plugin name="com.telerik.plugins.nativepagetransitions" spec="~0.6.5" />
    <plugin name="cordova-plugin-console" spec="~1.1.0" />
    <plugin name="cordova-plugin-device" spec="~1.1.4" />
    <plugin name="cordova-plugin-facebook4" spec="~1.9.1">
        <variable name="APP_ID" value="119928665301467" />
        <variable name="APP_NAME" value="myApplication" />
    </plugin>
    <plugin name="cordova-plugin-inappbrowser" spec="~1.7.1" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="~2.2.3" />
    <plugin name="cordova-plugin-whitelist" spec="~1.3.1" />
    <plugin name="cordova-plugin-x-socialsharing" spec="~5.2.1" />
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <plugin name="phonegap-plugin-push" spec="~2.1.0" />
    <plugin name="cordova-plugin-ionic-webview" spec="^1.1.11" />
    <plugin name="phonegap-plugin-push" spec="2.0.0" />
</widget>

My app.component.ts

import { Component, ViewChild } from '@angular/core';
import { Nav, Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import firebase from 'firebase';
import {Push,PushToken} from '@ionic/cloud-angular';

// import { CategoriesPage } from '../pages/categories/categories';
// import { PromoListPage } from '../pages/promolist/promolist';
// import { SellersPage } from '../pages/sellers/sellers';
// import { NewsPage } from '../pages/news/news';
// import { AboutPage } from '../pages/about/about';
// import { LoginPage } from '../pages/login/login';
// import { locationPage } from '../pages/location/location';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;
  public registered:any;
  rootPage: any;

  appPages: Array<{title: string, component: any, icon : any}>;

  constructor(public platform: Platform, public push: Push) {
    this.registered=localStorage.getItem("registered");
    firebase.initializeApp({
      apiKey: "AIzaSyDmdWszJ66QcV5rBC5co_Rnx60CgaZWcpM",
      authDomain: "udesign-1479985220086.firebaseapp.com",
      databaseURL: "https://udesign-1479985220086.firebaseio.com",
      storageBucket: "udesign-1479985220086.appspot.com",
      messagingSenderId: "434114141360"
    });
    // if(this.registered){
    //   this.rootPage=CategoriesPage;
    // }
    // else{this.rootPage=LoginPage;}
    //  platform.ready().then(() => {
    //   this.push.register().then((t: PushToken) => {
    //     return this.push.saveToken(t);
    //   }).then((t: PushToken) => {
    //     console.log('Token saved:', t.token);
    //   });
    //   this.push.rx.notification()
    //   .subscribe((msg) => {
    //     alert(msg.title + ': ' + msg.text);
    //   });
    //   StatusBar.styleDefault();
    //   Splashscreen.hide();
    // });

    // this.appPages = [
    //   { title: 'Home', component: CategoriesPage, icon: 'home'},
    //   { title: 'About HC Mall', component: AboutPage, icon: 'information-circle'},
    //   { title: 'Brands', component: SellersPage, icon: 'list'},
    //   { title: 'Promotions', component: PromoListPage, icon: 'pricetags'},
    //   { title: 'News', component: NewsPage, icon: 'paper'},
    //   { title: 'Contact Us', component: locationPage, icon: 'pin'}
    // ];

  }




  openPage(page) {
    this.nav.setRoot(page.component);
  }
}