在Ionic 2

时间:2017-04-25 21:18:14

标签: angular ionic-framework ionic2

我只想在运行的Ionic 2应用程序中添加背景地理位置:

 npm install --save @ionic-native/background-geolocation

我收到错误:

> ├── @ionic-native/background-geolocation@3.5.0  ├── UNMET PEER
> DEPENDENCY @ionic-native/core@^3.1.0 └── UNMET PEER DEPENDENCY
> rxjs@5.0.0-beta.12
> 
> npm WARN @ionic-native/background-geolocation@3.5.0 requires a peer of
> @ionic-native/core@^3.1.0 but none was installed. npm WARN
> @ionic-native/background-geolocation@3.5.0 requires a peer of
> rxjs@^5.0.1 but none was installed.

我的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-native/background-geolocation": "^3.5.0",
    "@ionic-native/core": "^3.5.0",
    "@ionic/cloud-angular": "^0.11.0",
    "@ionic/storage": "1.1.7",
    "ionic-angular": "2.0.1",
    "ionic-native": "2.4.1",
    "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": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "App2: An Ionic project"
}

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

对等依赖只是一个警告,它不会破坏你的构建,你需要的对等依赖是@ionic-native/core@^3.1.0rxjs@^5.0.1

我看到您"rxjs": "5.0.0-beta.12"将其更改为"rxjs": "^5.0.1"

至于@ionic-native/core我看到你有"@ionic-native/core": "^3.5.0"及其对等依赖需要的更高版本..可能会没问题。