我正在使用Ionic 2并试图使用@ ionic-native / geolocation,当我做离子时:我的项目上的serv我得到了这个错误:找不到名字'Observable'。
去AZ小说网POI她CK.i蒙古人.com/DX ND炒.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"
]
}
}
文件夹并运行一个新的node_modules
。您可能还想尝试运行npm install
并重新添加ionic plugin remove cordova-plugin-geolocation
我没有添加@ ionic-native / geolocation,它在添加后现在正在工作,谢谢。
你的package.json缺少ionic plugin add cordova-plugin-geolocation
。
做:
@ionic-native/geolocation
安装它。