2017-12-18 32 views
1

我想讓我的應用程序在離子3上生成模式。我嘗試如何在生產模式下創建應用程序Ionic3?

ionic cordova run android --prod --release 

但我一直錯誤:

Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.

我的package.json模樣爲:

{ 
    "name": "ionic-wordpress", 
    "version": "0.0.1", 
    "author": "IonicThemes", 
    "homepage": "https://ionicthemes.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.1.3", 
    "@angular/compiler": "4.1.3", 
    "@angular/compiler-cli": "4.1.3", 
    "@angular/core": "4.1.3", 
    "@angular/forms": "4.1.3", 
    "@angular/http": "4.1.3", 
    "@angular/platform-browser": "4.1.3", 
    "@angular/platform-browser-dynamic": "4.1.3", 
    "@ionic-native/core": "3.12.1", 
    "@ionic-native/native-storage": "^4.2.1", 
    "@ionic-native/splash-screen": "3.12.1", 
    "@ionic-native/status-bar": "3.12.1", 
    "@ionic/storage": "^2.1.3", 
    "android-versions": "^1.2.1", 
    "cordova-android": "^6.3.0", 
    "cordova-browser": "^4.1.0", 
    "cordova-ios": "^4.4.0", 
    "cordova-plugin-console": "^1.1.0", 
    "cordova-plugin-device": "^1.1.7", 
    "cordova-plugin-nativestorage": "^2.2.2", 
    "cordova-plugin-splashscreen": "^4.1.0", 
    "cordova-plugin-statusbar": "^2.3.0", 
    "cordova-plugin-whitelist": "^1.3.3", 
    "ionic-angular": "3.6.0", 
    "ionic-plugin-keyboard": "^2.2.1", 
    "ionicons": "3.0.0", 
    "q": "^1.5.1", 
    "rxjs": "5.4.0", 
    "sw-toolbox": "3.6.0", 
    "zone.js": "0.8.12" 
    }, 
    "devDependencies": { 
    "@ionic/app-scripts": "2.1.3", 
    "ionic": "3.12.0", 
    "typescript": "2.3.4" 
    }, 
    "description": "An Ionic project", 
    "cordova": { 
    "plugins": { 
     "cordova-plugin-nativestorage": {}, 
     "cordova-plugin-console": {}, 
     "cordova-plugin-device": {}, 
     "cordova-plugin-splashscreen": {}, 
     "cordova-plugin-statusbar": {}, 
     "cordova-plugin-whitelist": {}, 
     "ionic-plugin-keyboard": {} 
    }, 
    "platforms": [ 
     "browser", 
     "ios", 
     "android" 
    ] 
    } 
} 

也是我的NPM-具有的debug.log下一錯誤

160758 error Linux 4.10.0-28-generic 
160759 error argv "/usr/bin/nodejs" "/usr/lib/node_modules/npm/bin/npm-cli.js" "install" "--scripts-prepend-node-path=auto" 
160760 error node v4.8.4 
160761 error npm v2.15.11 
160762 error code EPEERINVALID 
160763 error peerinvalid The package @ionic-native/[email protected] does not satisfy its siblings' peerDependencies requirements! 
160763 error peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/[email protected]^4.2.0 
160763 error peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/[email protected]^3.6.0 
160763 error peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/[email protected]^3.6.0 
160764 verbose exit [ 1, true ] 

請幫我找個錯誤。如果在默認模式下運行的應用程序,它是工作正常

ionic cordova run android

我GOOGLE之前詢問很多。謝謝。

+0

檢查與app.module.ts – Edison

+0

@Edison,請看看我的屏幕http://joxi.ru/J2b4x4VT4eMGMr所有的供應商。我有一個提供者和服務,但他們都包含提供者。 –

回答

0

我發現enter link description here解決了romeodenis5

@NgModule({ 
providers: [ storage, ... ] 
}) 
in app.module.ts 

NOTE since @ionic/storage 2.x.x 
we import 
IonicStorageModule instead of storage 
相關問題