Ionic 3-应用程序挂在初始屏幕上(可能与Ionic Deploy有关)

时间:2018-09-15 22:35:35

标签: cordova ionic-framework ionic3

我在对离子应用程序进行了一些更改,突然决定挂在初始屏幕上,根本不加载该应用程序。我将调试器附加到正在使用的仿真器上,这是生成的错误消息:

Unhandled Promise rejection: Cannot read property 'getServerBasePath' of undefined ; Zone: <root> ; Task: Promise.then ; Value:
polyfills.js:3
TypeError: Cannot read property 'getServerBasePath' of undefined
polyfills.js:3
TypeError: Cannot read property 'getServerBasePath' of undefined
    at IonicDeployImpl.<anonymous> (file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:575:46)
    at step (file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:37:23)
    at Object.next (file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:18:53)
    at file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:12:71
    at new t (file:///android_asset/www/build/polyfills.js:3:21506)
    at __awaiter (file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:8:12)
    at file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:572:87
    at new t (file:///android_asset/www/build/polyfills.js:3:21506)
    at IonicDeployImpl.<anonymous> (file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:572:39)
    at step (file:///android_asset/www/plugins/cordova-plugin-ionic/dist/common.js:37:23)

几乎就像离子实时部署由于某种原因而失败一样,但是我不确定为什么-我的package.json在下面列出。

我在官方的ionic问题跟踪论坛上发现了一些问题,但是在大多数情况下,我使用的cordova-plugin-ionic版本大于发生这些问题的版本:

Issue 107 Issue 109

这个问题(Issue 116)似乎是我所经历的最接近的问题,但与我不认为的还是不一样。

任何帮助将不胜感激,因为我觉得我已经用尽了解决该问题的所有想法。

Package.json

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "config": {
    "ionic_bundler": "webpack",
    "ionic_source_map": "source-map",
    "ionic_copy": "./config/copy.config.js"
  },
  "dependencies": {
    "@angular/animations": "5.0.3",
    "@angular/common": "5.0.3",
    "@angular/compiler": "5.0.3",
    "@angular/compiler-cli": "5.0.3",
    "@angular/core": "5.0.3",
    "@angular/forms": "5.0.3",
    "@angular/http": "5.0.3",
    "@angular/platform-browser": "5.0.3",
    "@angular/platform-browser-dynamic": "5.0.3",
    "@auth0/angular-jwt": "^1.2.0",
    "@ionic-native/admob-free": "^4.8.0",
    "@ionic-native/base64": "^4.8.0",
    "@ionic-native/camera": "^4.8.0",
    "@ionic-native/core": "^4.8.0",
    "@ionic-native/crop": "^4.8.0",
    "@ionic-native/diagnostic": "^4.8.0",
    "@ionic-native/splash-screen": "^4.8.0",
    "@ionic-native/status-bar": "^4.8.0",
    "@ionic/storage": "2.1.3",
    "angular-calendar": "0.24.1",
    "angular-jwt": "0.1.9",
    "com-badrit-base64": "^0.2.0",
    "cordova-admob-sdk": "^0.17.0",
    "cordova-android": "~6.3.0",
    "cordova-ios": "^4.3.1",
    "cordova-plugin-admob-free": "^0.17.2",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-console": "^1.0.5",
    "cordova-plugin-crop": "^0.4.0",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-ionic": "^5.2.4",
    "cordova-plugin-ionic-webview": "^2.1.4",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-promise-polyfill": "0.0.2",
    "cordova.plugins.diagnostic": "^4.0.8",
    "cropperjs": "^1.4.0",
    "exif-js": "^2.3.0",
    "font-awesome": "^4.7.0",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "jimp": "^0.2.27",
    "moment": "^2.18.1",
    "rxjs": "^5.5.2",
    "sw-toolbox": "3.6.0",
    "ts-exif-parser": "^0.1.23",
    "web-photo-filter": "^1.1.1",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.7",
    "@ionic/pro": "^2.0.3",
    "@types/node": "^10.3.6",
    "typescript": "~2.4.2"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "SafteyTicketApp: An Ionic project",
  "cordova": {
    "platforms": [
      "ios",
      "android"
    ],
    "plugins": {
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-crop": {},
      "ionic-plugin-keyboard": {},
      "cordova.plugins.diagnostic": {},
      "cordova-plugin-admob-free": {},
      "com-badrit-base64": {},
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": "To track and record safety tickets.",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": "To track and record safety tickets."
      },
      "cordova-plugin-ionic": {
        "APP_ID": "APPID",
        "CHANNEL_NAME": "Production",
        "UPDATE_METHOD": "auto",
        "UPDATE_API": "https://api.ionicjs.com",
        "MAX_STORE": "2",
        "MIN_BACKGROUND_DURATION": "30"
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

我尝试重现您的环境,但没有失败。

我看到问题出在line

Ionic.WebView.getServerBasePath(resolve);

通过附加的safari调试程序,您可以访问Ionic全局变量吗?似乎未加载此变量。

我可以看到您没有安装webview插件,请尝试安装它:

cordova plugin add cordova-plugin-ionic-webview

尝试修复它的其他方法是删除 node_modules 插件平台并安装所有。或开始一个新项目,以查看新闻包/插件的版本以及版本。