Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxJS 6: Cannot find module 'rxjs/operators' #477

Closed
LayZeeDK opened this issue May 9, 2018 · 6 comments
Closed

RxJS 6: Cannot find module 'rxjs/operators' #477

LayZeeDK opened this issue May 9, 2018 · 6 comments

Comments

@LayZeeDK
Copy link

LayZeeDK commented May 9, 2018

Hi StackBlitz,

I have stumbled upon an error when developing a simple TypeScript StackBlitz using RxJS 6.1 (also 6.0). StackBlitz tells me Cannot find module 'rxjs/operators' when trying to import an operator. The rxjs module works well, but a simple import like import { map } from 'rxjs/operators'; results in the aforementioned error.

This is not just a static error. When I subscribe to fizzbuzz$ in https://stackblitz.com/edit/rxjs-fizzbuzz?file=index.ts, StackBlitz crashes entirely.

@apai4
Copy link
Member

apai4 commented May 9, 2018

@LayZeeDK it looks like the issue is actually coming from Number.MAX_SAFE_INTEGER in fizzbuzz.ts which is creating a loop that is too big for the browser to handle responsively. If you change the end of the range to something smaller the example seems to work fine:

https://stackblitz.com/edit/rxjs-fizzbuzz-ybxwfj?file=fizzbuzz.ts

@LayZeeDK
Copy link
Author

LayZeeDK commented May 10, 2018

How odd. You are definitely right.

Thank you for your support! 👍

@LayZeeDK
Copy link
Author

LayZeeDK commented May 10, 2018

I changed it to

import { animationFrameScheduler } from 'rxjs';

const number$: Observable<number> = range(0, Number.MAX_SAFE_INTEGER, animationFrameScheduler);

and it ran smooth.

@developerjohan01
Copy link

Still looks like there is an issue with this.
Creating a new TS project and adding the RxJS dependency.
Now adding the imports used in the above projects, eg:

import { animationFrameScheduler, Observable, range, zip } from 'rxjs';
import { map } from 'rxjs/operators';

And you get the error: Cannot find module 'rxjs/operators'

For an example see https://stackblitz.com/edit/typescript-dquxft?file=index.ts

If I clone one of the working projects above and use that as a starting point then it is working - same content/code and dependencies in both project. See
https://stackblitz.com/edit/ts-rxjs6-test-ommwas?file=index.ts

@jgbpercy
Copy link

This is probably related:

  • This stackblitz shows an incorrect TS error: https://stackblitz.com/edit/typescript-fiigar - I believe that for some reason there are two imports of RxJS, which results in TS trying to check if two separate but identical version of the Observable class are compatible (they are not, because separate declarations of identical protected/private members are not considered compatible by TS).
  • I tried to make a more minimal repro here: https://stackblitz.com/edit/typescript-7c1ctq - but the error doesn't show up. However, if you copy paste my index.ts code over the index.ts in https://stackblitz.com/edit/typescript-fiigar then you do reproduce the (incorrect) error on line 5 (or at least that happens for me). So something weird is definitely happening with TS imports!

This is all on Chrome 69, but seems to be the same on Edge too at least.

@github-actions
Copy link

Apologies that we were unable to address this issue in a timely manner!

Given that we have millions of free users this has been a challenge, and we are working to improve over time. As part of an effort to focus on driving the most recent issues to resolution, this issue is being closed.

If this issue is still meaningful, please comment with an update and re-open the issue for troubleshooting! Thanks for your continued loyalty to the StackBlitz platform over the years!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants