打字稿错误找不到姓名' Observable'在@ ionic-native / geolocation中

时间:2017-05-06 18:52:03

标签: angular ionic2 ionic3

我正在使用Ionic 2并尝试使用@ ionic-native / geolocation,当我做离子时:我的项目上的serv我得到了这个错误: 找不到姓名' Observable'。

[1]: https://i.s tack.imgur.com/dXNDc.png

这是我的package.json文件内容:

{
  "author": "",
  "cordovaPlatforms": [],
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "cordova-plugin-geolocation"
  ],
  "dependencies": {
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@ionic-native/core": "3.6.1",
    "@ionic-native/splash-screen": "3.4.2",
    "@ionic-native/status-bar": "3.4.2",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "^3.1.1",
    "ionicons": "3.0.0",
    "rxjs": "^5.3.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "^0.8.5"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.4",
    "typescript": "~2.2.1"
  },
  "homepage": "",
  "name": "Wakeb",
  "version": "0.0.0",
  "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",
    "watch": "ionic-app-scripts watch"
  },
  "-vs-binding": {
    "ProjectOpened": [
      "ionic:build",
      "ionic:serve"
    ]
  }
}

提前谢谢。

3 个答案:

答案 0 :(得分:0)

尝试删除node_modules文件夹并运行新的npm install。您可能还想尝试运行ionic plugin remove cordova-plugin-geolocation并重新添加ionic plugin add cordova-plugin-geolocation

答案 1 :(得分:0)

我没有添加@ ionic-native / geolocation,它在添加后现在正在使用,谢谢。

答案 2 :(得分:0)

您的package.json缺少@ionic-native/geolocation

执行:

 npm install --save @ionic-native/geolocation

安装它。