2016-10-11 6 views
0

私はIonic2を使用しています。PCがクラッシュし、今すぐCordovaプラグインを再インストールします

私のPCがクラッシュし、私のアプリケーションを再インストールする必要がありました。幸いなことに、すべてのソースコードをバックアップしました。

Androidデバイスでクラッシュする前にソースコードが完全に動作していました。

ionic build android

私の問題私が構築し、apkをインストールするときに、今、プラグインのいくつかは、デバイス上で動作しません。以前はこれが機能していたため、これらのエラーは依存関係と関連している必要があります。

どのようにエラーを解決するためのアイデアをいただければ幸いです。

1)SQLiteのエラー

Unable to open database 
ReferenceError 
message: "sqlitePlugin is not defined" 
stack: (...) 
get stack: function() { [native code] } 
set stack: function() { [native code] } 
__proto__: Error 

app.ts

import { StatusBar, Push, SQLite } from 'ionic-native';

private createDatabase(): void { 
    let db: SQLite = new SQLite(); 
    db.openDatabase({ 
     name: "data.db", 
     location: "default" 
    }).then(() => { 
     db.executeSql("CREATE TABLE IF NOT EXISTS chats (_id TEXT PRIMARY KEY, memberIds TEXT, title TEXT, subTitle TEXT, picture TEXT, lastMessageId TEXT, lastMessageCreatedAt DATE)", {}).then((chatData) => { 
     db.executeSql("CREATE TABLE IF NOT EXISTS messages (_id TEXT PRIMARY KEY, chatId TEXT, senderId TEXT, ownership TEXT, content TEXT, createdAt DATE, changeDate BOOLEAN, readByReceiver BOOLEAN)", {}).then((messageData) => { 
     }, (error) => { 
      console.error("Unable to execute messages sql", error); 
     }); 

     }, (error) => { 
     console.error("Unable to execute chats sql", error); 
     }); 
    }, (error) => { 
     console.error("Unable to open database", error); 
    }); 
    } 

2 )

PositionError {message: "Timeout expired", code: 3, PERMISSION_DENIED: 1, POSITION_UNAVAILABLE: 2, TIMEOUT: 3}

tsが

import { Geolocation } from 'ionic-native'; 

    public getPosition(): void { 
     if (this.markers && this.markers.length > 0) { 
      var marker: google.maps.Marker = this.markers[0]; // only one 
      this.latitude = marker.getPosition().lat(); 
      this.longitude = marker.getPosition().lng(); 
      this.getJobRangeSearch(this.searchQuery); 
     } else { 
      let options = { 
       timeout: 10000, 
       enableHighAccuracy: true 
      }; 
      Geolocation.getCurrentPosition(options).then((position) => { 
       this.latitude = position.coords.latitude; 
       this.longitude = position.coords.longitude; 
       this.getJobRangeSearch(this.searchQuery); 
      }).catch((error) => { 
       console.log(error); 
       this.doAlert(error+' Timeout trying to get your devices Location'); 
      }); 
     } 
    } 

ファイルジオロケーションエラー私は警告Timeout trying to get your devices Locationエラーが発生します。

package.json

{ 
    "dependencies": { 
    "@angular/common": "^2.0.0-rc.4", 
    "@angular/compiler": "^2.0.0-rc.4", 
    "@angular/core": "^2.0.0-rc.4", 
    "@angular/forms": "^0.2.0", 
    "@angular/http": "^2.0.0-rc.4", 
    "@angular/platform-browser": "^2.0.0-rc.4", 
    "@angular/platform-browser-dynamic": "^2.0.0-rc.4", 
    "accounts-base-client-side": "^0.1.1", 
    "accounts-phone": "0.0.1", 
    "angular2-meteor": "^0.6.2", 
    "angular2-meteor-polyfills": "^0.1.1", 
    "angular2-moment": "^0.8.2", 
    "es6-shim": "^0.35.0", 
    "ionic-angular": "^2.0.0-beta.11", 
    "ionic-native": "^1.3.2", 
    "ionicons": "3.0.0", 
    "meteor-client-side": "^1.3.4", 
    "moment": "^2.14.1", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "5.0.0-beta.6", 
    "socket.io": "^1.4.8", 
    "zone.js": "^0.6.12" 
    }, 
    "devDependencies": { 
    "del": "2.2.0", 
    "gulp": "3.9.1", 
    "gulp-watch": "4.3.5", 
    "ionic-gulp-fonts-copy": "^1.0.0", 
    "ionic-gulp-html-copy": "^1.0.0", 
    "ionic-gulp-sass-build": "^1.0.0", 
    "ionic-gulp-scripts-copy": "^2.0.0", 
    "ionic-gulp-tslint": "^1.0.0", 
    "ionic-gulp-webpack": "^2.0.0", 
    "lodash.camelcase": "^4.3.0", 
    "lodash.upperfirst": "^4.3.1", 
    "run-sequence": "1.1.5", 
    "ts-loader": "^0.8.2", 
    "tslint-ionic-rules": "^0.0.3", 
    "webpack": "^1.13.2" 
    }, 
    "name": "theWhoZoo", 
    "description": "theWhoZoo: An Ionic project", 
    "cordovaPlugins": [ 
    "cordova-plugin-device", 
    "cordova-plugin-console", 
    "cordova-plugin-whitelist", 
    "cordova-plugin-splashscreen", 
    "cordova-plugin-statusbar", 
    "ionic-plugin-keyboard", 
    { 
     "variables": { 
     "SENDER_ID": "XXXXXXXXXXX" 
     }, 
     "locator": "phonegap-plugin-push", 
     "id": "phonegap-plugin-push" 
    } 
    ], 
    "cordovaPlatforms": [] 
} 

UPDATE

私が行う場合:

npm install ionic-angular 

私が取得:

+-- [email protected] 
| +-- UNMET PEER DEPENDENCY @angular/[email protected] 
| +-- UNMET PEER DEPENDENCY @angular/[email protected] 
| +-- UNMET PEER DEPENDENCY [email protected] 
| `-- UNMET PEER DEPENDENCY [email protected] 
+-- UNMET PEER DEPENDENCY [email protected] 
`-- UNMET PEER DEPENDENCY [email protected] 

rxjszone.jsをインストールするにはどうすればよいですか?

私が行う場合:

npm install zone.js 

は私が取得:

+-- UNMET PEER DEPENDENCY [email protected] 
`-- [email protected] 

私は依存関係をインストールしようとすると、それは同じ依存性が不足していると言います。これはどういう意味ですか?

npm install [email protected] --save 
`-- UNMET PEER DEPENDENCY [email protected] 

UPDATE

私はnode_modulesを削除し、npm istallpackage.jsonでパッケージを編と私は何の依存関係のエラーを得ませんでした。

しかし、今、私はapkを構築し、デバイス上でそれを実行し、私が取得:

Failed to load resource: net::ERR_FILE_NOT_FOUND file:///android_asset/www/build/js/app.bundle.js 
deviceready has not fired after 5 seconds. cordova.js:1185 
Channel not fired: onDOMContentLoaded 
+0

「npm install」コマンドを使用してpackage.jsonファイルにプラグインをインストールしてください。応援! – johnny

答えて

0

あなたのセットアップはかなりアップmesedようです。 :)

が役に立てば幸いionic state reset

Clear out the platforms and plugins directories, and reinstall plugins and platforms

を試してみてください。

関連する問題