can't Resolve rxjs

I got this error because of an older version of rxjs and Angular 6 needs the latest version of rxjs.

This command installs the latest version that is compatible with Angular 6.

npm install --save rxjs-compat

As Aravind has pointed out in his comments, case is important here. Instead of

import { of } from 'rxjs/Observable/of';

try (unsure the version)...

import { of } from 'rxjs/observable/of';  // note the lower-cased 'o' on 'observable'

or when version is > 6.x

import { of } from 'rxjs';

Based on Alexander Kim's comment, I must urge folks to go read the documentation, and get clear around the distinction between the 2 major operator types: creator, and everything else (mostly trans-formative).

Also, see this answer.

Try RxJS now! (opens new stackblitz session with RxJS library loaded)


Usually you will have a file in your project called something like rxjs-operators.ts which imports the parts of rxjs that you need. You should add this line to that file:

import 'rxjs/add/observable/of';

Also take out this line:

import { of } from 'rxjs/observable/of';

Alternatively, import it into your module directly, see if it works.