[英]How build app in production mode, Ionic3?
I want build my app on ionic 3 to production mode. 我想在ionic 3到生产模式下构建我的应用。 I try
我尝试
ionic cordova run android --prod --release
but I have always error: 但我总是出错:
Error: Encountered undefined provider!
错误:遇到未定义的提供者! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.
通常这意味着您具有循环依赖关系(可能是由于使用“ barrel” index.ts文件引起的。
my package.json look like as: 我的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"
]
}
}
also my npm-debug.log has next errors 我的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/core@3.12.1 does not satisfy its siblings' peerDependencies requirements!
160763 error peerinvalid Peer @ionic-native/native-storage@4.5.0 wants @ionic-native/core@^4.2.0
160763 error peerinvalid Peer @ionic-native/splash-screen@3.12.1 wants @ionic-native/core@^3.6.0
160763 error peerinvalid Peer @ionic-native/status-bar@3.12.1 wants @ionic-native/core@^3.6.0
160764 verbose exit [ 1, true ]
please help me find a mistake. 请帮助我发现一个错误。 if run app in default mode, it is work fine
如果以默认模式运行应用程序,则可以正常工作
ionic cordova run android
离子科尔多瓦运行Android
I googled a lot before asking. 在询问之前,我在Google上搜索了很多。 Thanks.
谢谢。
You need to remove storage
from providers
in your app.module.ts
, explanation can be found here . 您需要从
app.module.ts
providers
中删除storage
,可以在此处找到说明。
@NgModule({
providers: [ storage, ... ]
});
Note: Since @ionic/storage 2.xx, we need to import
IonicStorageModule
instead ofstorage
.注意:由于@ ionic / storage 2.xx,我们需要导入
IonicStorageModule
而不是storage
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.