簡體   English   中英

離子性-RXJS錯誤:rxjs_Observable __。Observable.combine最新不是函數

[英]ionic - RXJS error : rxjs_Observable__.Observable.combineLatest not a function

在我的Ionic 3.9應用程序中,出現以下錯誤: __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__.Observable.combineLatest is not a function在瀏覽器中運行ionic serve__WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__.Observable.combineLatest is not a function

我遇到了插件錯誤,因此刪除了node_modules,yarn.lock,並通過$ yarn install重新安裝了所有依賴項。

ERROR TypeError: __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__.Observable.combineLatest is not a function
    at NgxErrorDirective.ngOnInit (ngxerror.directive.js:40)
    at checkAndUpdateDirectiveInline (core.js:12369)
    at checkAndUpdateNodeInline (core.js:13893)

這是我的配置:

$ ionic info

Ionic:

   ionic (Ionic CLI)  : 4.6.0
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.0.0, browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, (and 5 other plugins)

System:

   Android SDK Tools : 25.2.5 (/home/louisro/android-sdk-linux/)
   NodeJS            : v8.9.4 (/home/louisro/.nvm/versions/node/v8.9.4/bin/node)
   npm               : 5.6.0
   OS                : Linux 4.4

這是$ yarn install給的:

$ yarn install
yarn install v1.12.3
info No lockfile found.
[1/4] Resolving packages...
warning angularfire2@5.1.1: AngularFire has moved, we're now @angular/fire
warning cordova-browser > path-is-absolute@2.0.0: This package is no longer relevant as Node.js 0.12 is unmaintained.
warning cordova-plugin-ionic > @types/cordova-plugin-file-transfer@1.6.2: This is a stub types definition for cordova-plugin-file-transfer (https://github.com/apache/cordova-plugin-file-transfer). cordova-plugin-file-transfer provides its own type definitions, so you don't need @types/cordova-plugin-file-transfer installed!
warning @ionic/app-scripts > autoprefixer > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @angular/common@5.2.9" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @angular/core@5.2.9" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @angular/forms@5.2.9" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @angular/http@5.2.9" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @ionic-native/camera@4.18.0" has incorrect peer dependency "@ionic-native/core@^4.11.0".
warning " > @ionic-native/camera@4.18.0" has incorrect peer dependency "rxjs@^5.5.11".
warning " > @ionic-native/core@4.5.3" has incorrect peer dependency "rxjs@^5.0.1".
warning " > @ionic-native/email-composer@4.18.0" has incorrect peer dependency "@ionic-native/core@^4.11.0".
warning " > @ionic-native/email-composer@4.18.0" has incorrect peer dependency "rxjs@^5.5.11".
warning " > @ionic-native/fcm@4.18.0" has incorrect peer dependency "@ionic-native/core@^4.11.0".
warning " > @ionic-native/fcm@4.18.0" has incorrect peer dependency "rxjs@^5.5.11".
warning " > @ionic-native/geolocation@4.18.0" has incorrect peer dependency "@ionic-native/core@^4.11.0".
warning " > @ionic-native/geolocation@4.18.0" has incorrect peer dependency "rxjs@^5.5.11".
warning " > @ionic-native/http@4.18.0" has incorrect peer dependency "@ionic-native/core@^4.11.0".
warning " > @ionic-native/http@4.18.0" has incorrect peer dependency "rxjs@^5.5.11".
warning " > @ionic-native/push@4.18.0" has incorrect peer dependency "@ionic-native/core@^4.11.0".
warning " > @ionic-native/push@4.18.0" has incorrect peer dependency "rxjs@^5.5.11".
warning " > @ionic-native/splash-screen@4.5.3" has incorrect peer dependency "rxjs@^5.0.1".
warning " > @ionic-native/status-bar@4.5.3" has incorrect peer dependency "rxjs@^5.0.1".
warning " > angular-svg-round-progressbar@2.0.0" has incorrect peer dependency "@angular/compiler@^6.0.0".
warning " > angular-svg-round-progressbar@2.0.0" has incorrect peer dependency "@angular/common@^6.0.0".
warning " > angular-svg-round-progressbar@2.0.0" has incorrect peer dependency "@angular/core@^6.0.0".
warning " > angular-svg-round-progressbar@2.0.0" has unmet peer dependency "core-js@^2.4.1".
warning " > angular-svg-round-progressbar@2.0.0" has incorrect peer dependency "zone.js@^0.8.26".
warning "angularfire2 > @angular/fire@5.1.1" has incorrect peer dependency "@angular/common@>=6.0.0 <8".
warning "angularfire2 > @angular/fire@5.1.1" has incorrect peer dependency "@angular/core@>=6.0.0 <8".
warning "angularfire2 > @angular/fire@5.1.1" has incorrect peer dependency "@angular/platform-browser@>=6.0.0 <8".
warning "angularfire2 > @angular/fire@5.1.1" has incorrect peer dependency "@angular/platform-browser-dynamic@>=6.0.0 <8".
warning "firebase > @firebase/storage@0.2.4" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/functions@0.3.3" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/functions > @firebase/messaging-types@0.2.3" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/storage > @firebase/storage-types@0.2.3" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/database@0.3.7" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/database > @firebase/database-types@0.3.2" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/auth > @firebase/auth-types@0.5.0" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/firestore@0.9.0" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/messaging@0.3.7" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/firestore > @firebase/firestore-types@0.8.0" has unmet peer dependency "@firebase/app-types@0.x".
warning " > ng2-charts-x@2.0.6" has incorrect peer dependency "rxjs@^5.1.0".
warning " > ng2-charts-x@2.0.6" has unmet peer dependency "moment@^2.18.1".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 72.88s.

似乎有一個問題Observable.combineLatest 很難假設不看代碼,但是如果您導入Observable的可能性更高,那么也需要像這樣導入CombineLatest

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/combineLatest';

希望它能工作。

正如yarn告訴您的:您有不正確的對等依賴性。

我看到您正在嘗試安裝需要@angular/common@>=6.0.0@angular/fire@5.1.1軟件包。 這也意味着將所有@angular/*rxjs依賴項升級到6.0.0或更高版本。

您還應該注意, rxjs 6與以前的版本之間有一些重大更改(您的CombineLatest錯誤可能來自此處)。 您也可以安裝rxjs-compat以保持您的代碼不變。

希望能幫助到你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM