Search code examples
angulartypescriptjwtangular2-routingangular2-services

Can't find angular2-jwt


First I installed angular-jwt with npm and this code:

npm install angular2-jwt --save

Then I completed the components with jwt imports {Observable , map , ...} but now I have a problem, the app can't find this properties.

ERROR in node_modules/angular2-jwt/angular2-jwt.d.ts(3,10): error TS2305: Module '"F:/Projects/Ove/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
src/app/github-followers/github-followers.component.ts(1,10): error TS2305: Module '"F:/Projects/Ove/node_modules/rxjs/Observable"' has no exported member 'Observable'.
src/app/services/auth.service.ts(16,8): error TS2339: Property 'map' does not exist on type 'Observable<Response>'.
src/app/services/data.service.ts(6,10): error TS2305: Module '"F:/Projects/Ove/node_modules/rxjs/Observable"' has no exported member 'Observable'.
src/app/services/data.service.ts(18,8): error TS2339: Property 'map' does not exist on type 'Observable<Response>'.
src/app/services/data.service.ts(24,8): error TS2339: Property 'map' does not exist on type 'Observable<Response>'.
src/app/services/data.service.ts(30,8): error TS2339: Property 'map' does not exist on type 'Observable<Response>'.
src/app/services/data.service.ts(36,8): error TS2339: Property 'map' does not exist on type 'Observable<Response>'.
src/app/services/data.service.ts(42,8): error TS2339: Property 'map' does not exist on type 'Observable<Response>'.


Solution

  • v6 import has changed.

    v5 was, as it appears you used:

    import { Observable } from 'rxjs/Observable';
    

    v6 is

    import { Observable } from 'rxjs';