我将离子CLI版本升级到4.1.2,现在我正尝试使用Goelocation插件,但出现此错误
ERROR in node_modules/@ionic-native/geolocation/index.d.ts(2,10): error TS2305: Module '"C:/projects/ionic/myApp3/node_modules/rxjs/Observable"' h
as no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
[ng] i 「wdm」: Failed to compile.
我想知道如何解决此错误。
我当时正在考虑降级我的离子CLI版本,并尝试下载一个新的离子应用程序,但是我找到了一种方法。
将我的离子CLI版本降级到版本3的代码是什么?
答案 0 :(得分:1)
您可以通过运行以下命令来降级离子CLI版本:
npm install -g ionic@3.9.2
请在https://github.com/ionic-team/ionic-cli/releases
或
或者,您需要删除node_modules文件夹并通过添加以下代码来修改package.json文件:
"dependencies": {
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"ionic-angular": "3.9.2",
"ionic-native": "^2.9.0",
"rxjs": "5.5.11"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.11",
"typescript": "~2.6.2"
}
然后需要运行以下命令:
npm install