我正在尝试安装"全球化"插件,以便在我的离子2应用程序中访问.getPreferredLanguage(),但我得到了这个UNMET DEPENDENCY错误。
$ ionic plugin add cordova-plugin-globalization --savePlugin "cordova-plugin-globalization" already installed on android.
Plugin "cordova-plugin-globalization" already installed on ios.
Saved plugin info for "cordova-plugin-globalization" to config.xml
$ npm install --save @ionic-native/globalizationboardline@1.0.0 /home/louisro/Documents/mobileApps/BoardLine/ionic_version
├── UNMET PEER DEPENDENCY @angular/core@*
├── UNMET PEER DEPENDENCY @ionic-native/core@^3.1.0
├── @ionic-native/globalization@3.4.4
└── UNMET PEER DEPENDENCY rxjs@^5.0.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @ionic-native/globalization@3.4.4 requires a peer of @ionic-native/core@^3.1.0 but none was installed.
npm WARN @ionic-native/globalization@3.4.4 requires a peer of @angular/core@* but none was installed.
npm WARN @ionic-native/globalization@3.4.4 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic/cloud-angular@0.4.0 requires a peer of @angular/core@>=2.0.0-rc.0 <2.0.0-rc.5 but none was installed.
npm WARN @ionic/cloud-angular@0.4.0 requires a peer of rxjs@>=5.0.0-beta.0 but none was installed.
和
$ ionic info
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.4.0
Xcode version: Not installed
编辑我在这里添加package.json代码: 的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.4.8",
"@angular/compiler": "2.4.8",
"@angular/compiler-cli": "2.4.8",
"@angular/core": "2.4.8",
"@angular/forms": "2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic-native/app-version": "^3.4.4",
"@ionic-native/core": "^3.4.1",
"@ionic-native/device": "^3.4.1",
"@ionic-native/geolocation": "^3.4.4",
"@ionic-native/google-analytics": "^3.4.4",
"@ionic-native/keyboard": "^3.4.4",
"@ionic-native/onesignal": "^3.4.4",
"@ionic-native/splash-screen": "^3.4.4",
"@ionic-native/status-bar": "^3.4.4",
"@ionic/storage": "^2.0.0",
"@types/pouchdb": "5.4.28",
"angular-2-local-storage": "^1.0.1",
"ionic-angular": "2.2.0",
"ionic-native": "2.8.1",
"ionicons": "3.0.0",
"lodash": "^4.17.4",
"ng2-translate": "^5.0.0",
"pouchdb": "^6.1.2",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.7.2"
},
"devDependencies": {
"@ionic/app-scripts": "^1.1.4",
"@types/cordova": "0.0.34",
"@types/cordova-ionic": "0.0.29",
"@types/node": "^7.0.12",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"cordova-plugin-whitelist",
"cordova-plugin-console"
],
"cordovaPlatforms": [],
"description": "Boane: An Ionic project"
}
答案 0 :(得分:2)
你的问题在于"ionic-native": "2.8.1",
。你必须删除它,以便只有一行离子原生:"@ionic-native/core": "^3.4.4",
。
之后运行npm i