Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Observable
✓ import { Observable } from 'rxjs';
✗ const { Observable } = require('rxjs');
While CommonJS `require` works for UMD bundles in some environments, modern Node.js and browser build setups typically use ESM `import`. For core classes, use named imports.
of, map, filter
✓ import { of, map, filter } from 'rxjs';
✗ import { map, filter } from 'rxjs/operators';
Since RxJS v7.2, all creation functions (like `of`) and pipeable operators (like `map`, `filter`) are exported directly from the top-level 'rxjs' module. Prior to v7.2, operators were imported from 'rxjs/operators'.
Subject
✓ import { Subject } from 'rxjs';
✗ import { Subject } from 'rxjs/internal/Subject';
Import `Subject` directly from the 'rxjs' module. Importing from internal paths is not recommended as they are subject to change without major version bumps.
Demonstrates creating an Observable, applying pipeable operators (`filter`, `map`), and subscribing to process data, along with a basic timer example.
import { range, filter, map, Observable } from 'rxjs';
// Create an observable that emits numbers from 1 to 200
const source$: Observable<number> = range(1, 200);
// Pipe operators to transform the stream
const processedStream$ = source$.pipe(
filter(x => x % 2 === 1), // Keep only odd numbers
map(x => x + x) // Double each odd number
);
// Subscribe to the stream to receive values and log them
console.log('Starting stream subscription...');
processedStream$.subscribe({
next: x => console.log(`Received: ${x}`), // Log each emitted value
error: err => console.error('An error occurred:', err), // Handle errors
complete: () => console.log('Stream completed.') // Log when the stream finishes
});
// Example of a simple timer to show asynchronous nature
import { timer } from 'rxjs';
timer(2000, 1000).subscribe(val => console.log(`Timer tick: ${val}`));
Debug
Known issues
breakingStarting with RxJS v7.2, all creation functions and pipeable operators are exported directly from the main 'rxjs' package. Importing operators from 'rxjs/operators' is deprecated and will not work in newer versions.fixUpdate your imports: `import { of, map, filter } from 'rxjs';` instead of `import { map, filter } from 'rxjs/operators';` affects: >=7.2
breakingRxJS v8 (currently in alpha) removes the `Subject.create` static method. This method was deprecated in previous versions.fixInstead of `Subject.create(observer)`, directly instantiate a `Subject` and manage subscriptions and emissions: `const subject = new Subject();`
affects: >=8.0.0-alpha.13
breakingRxJS v8 (currently in alpha) removes the `Symbol.observable` export.fixIf you relied on `Symbol.observable` for interop, consider alternative strategies or check for updated guidance on observable interop in RxJS 8.
affects: >=8.0.0-alpha.13
breakingIn RxJS v8 (currently in alpha), `WebSocketSubject` no longer extends `Subject`. This changes its inheritance chain and may impact assumptions about its API.fixReview code that casts `WebSocketSubject` to `Subject` or relies on `Subject` methods directly. Adjust usage to use `WebSocketSubject`'s specific API, or use a new `Subject` instance to bridge if `Subject` functionality is still required.
affects: >=8.0.0-alpha.13
gotchaMigrating from RxJS 6 to 7 introduced several breaking changes beyond just operator imports, including changes to `lift`, default schedulers, and error handling. Code written for RxJS 6 may not directly compile or run correctly in RxJS 7.fixConsult the official migration guide from RxJS 6 to 7 (often linked on the RxJS website or GitHub repository) for a comprehensive list of changes and recommended updates.
affects: >=7.0.0
Errors
Common errors & fixes
TypeError: (0, rxjs_operators_1.map) is not a function
Attempting to import `map` from 'rxjs/operators' in RxJS 7.2 or higher, where it's no longer exported from that path.
fixChange the import to `import { map } from 'rxjs';` (and similarly for other operators). TypeError: Cannot read properties of undefined (reading 'subscribe')
Attempting to call `.subscribe()` on a variable that is `undefined`, often due to an incorrect observable creation or a `null` value being returned unexpectedly.
fixEnsure the variable you're calling `.subscribe()` on is indeed an `Observable` instance. Debug the preceding code to verify that an `Observable` is correctly created and assigned.
TS2307: Cannot find module 'rxjs/operators' or its corresponding type declarations.
This error occurs in TypeScript when 'rxjs/operators' is imported in RxJS 7.2+ where the module no longer exists as a separate entry point.
fixUpdate all imports from `rxjs/operators` to `rxjs`. For example, `import { map } from 'rxjs/operators';` becomes `import { map } from 'rxjs';`. Audit
Dependencies
No dependency data recorded yet.