我想在离子3上构建我的应用程序到生产模式。我试试
ionic cordova run android --prod --release
但我总是错误:
错误:遇到未定义的提供程序!通常这意味着你有一个 循环依赖(可能是由'barrel'index.ts引起的 文件。
我的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/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 ]
请帮我找个错误。如果在默认模式下运行app,它可以正常工作
离子cordova运行android
我在搜索之前搜索了很多。感谢。
答案 0 :(得分:0)
您需要从storage
中的providers
移除app.module.ts
,可以找到解释here。
@NgModule({
providers: [ storage, ... ]
});
注意:自@ ionic / storage 2.x.x起,我们需要导入
IonicStorageModule
代替storage
。