2017-03-18 65 views
0

我正嘗試構建離子應用程序的生產構建。未能爲我的離子2應用程序構建生產構建

ionic run android

但是,當我試圖通過使用

ionic run android --prod

我收到此錯誤打造我的生產應用:

Cannot read property 'componentType' of undefined main.js:7.

,如果正在運行與我的應用程序,一切工作正常我的應用程序停留在閃屏

這是我的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" 
    }, 
    "dependencies": { 
    "@angular/common": "2.2.1", 
    "@angular/compiler": "2.2.1", 
    "@angular/compiler-cli": "2.2.1", 
    "@angular/core": "2.2.1", 
    "@angular/forms": "2.2.1", 
    "@angular/http": "2.2.1", 
    "@angular/platform-browser": "2.2.1", 
    "@angular/platform-browser-dynamic": "2.2.1", 
    "@angular/platform-server": "2.2.1", 
    "@ionic/cloud-angular": "^0.11.0", 
    "@ionic/storage": "1.1.7", 
    "angular2-focus": "^1.0.3", 
    "angular2-moment": "^1.1.0", 
    "ionic-angular": "2.0.0-rc.4", 
    "ionic-gallery-modal": "0.0.7", 
    "ionic-native": "2.2.11", 
    "ionicons": "3.0.0", 
    "rxjs": "5.0.0-beta.12", 
    "sw-toolbox": "3.4.0", 
    "zone.js": "0.6.26" 
    }, 
    "devDependencies": { 
    "@ionic/app-scripts": "1.0.0", 
    "typescript": "2.0.9" 
    }, 
    "cordovaPlugins": [ 
    "cordova-plugin-whitelist", 
    "cordova-plugin-console", 
    "cordova-plugin-statusbar", 
    "cordova-plugin-device", 
    "cordova-plugin-splashscreen", 
    "ionic-plugin-keyboard" 
    ], 
    "cordovaPlatforms": [], 
    "description": "App: An Ionic project" 
} 

回答

0

的命令是buildrun。 嘗試:

ionic build android --release --prod 

run將建立和連接的設備或模擬器中運行

+0

如果我使用上面的命令構建它,然後對它進行簽名並嘗試在設備中安裝,即使它在啓動屏幕上停止, – devanshsadhotra

+0

您是否在任何位置使用componentType? –

+0

它只是在main.js中,並且沒有其他地方我已經在我的應用程序中使用它 – devanshsadhotra

0

的問題是與創建當您使用「離子生成「頁面name.module.ts」文件頁面「命令。 手動創建頁面並再次運行它(離子運行android --prod)或(ionic build android --prod)。 它爲我工作。 他們很快修復它們的主頁。

+0

得到了解決,這是插件問題, – devanshsadhotra

相關問題