Bart van den Burg
Bart van den Burg

Reputation: 2344

Angular 6: operators.share is not defined

I upgraded my nativescript project to Angular 6, but now when I run it I instantly get presented the following error:

JS: bootstrap: ERROR BOOTSTRAPPING ANGULAR
JS: bootstrap: operators.share is not a function
JS:
JS: TypeError: operators.share is not a function
JS:     at new ApplicationRef (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:4446:67)
JS:     at _createClass (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:8210:20)
JS:     at _createProviderInstance$1 (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:8172:26)
JS:     at initNgModule (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:8108:32)
JS:     at new NgModuleRef_ (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:8831:9)
JS:     at createNgModuleRef (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:8820:12)
JS:     at Object.debugCreateNgModuleRef [as createNgModuleRef] (file:///data/data/io.neocles.dev/files/app/tns_modules/@angular/core/bundles/core.umd.js:10645:12)
JS:     at NgModuleFactory_.create (...

I upgraded to rxjs 6, but am still using rxjs-compat. I include a file in my root called "rxjs-operators" which imports all the rxjs components I use. share wasn't one of those, but adding it to the list doesn't change anything.

I tracked the error back to the following loc in core.umd.js:

    this.isStable =
        rxjs.merge(isCurrentlyStable, isStable.pipe(operators.share()));

Why am I getting this error and how can I fix it?

Upvotes: 3

Views: 413

Answers (1)

Raphael Jenni
Raphael Jenni

Reputation: 318

Had the same error after upgrading NativeScript to Angular 6. In my case I was running the wrong NativeScript version --> use NativeScript > 4.1 and the newest nativescript-angular version.

Upvotes: 2

Related Questions