Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module 'rxjs/internal/Observable'

I want to use JwtHelperService module in my service but I got below error:

ERROR in node_modules/@auth0/angular-jwt/src/jwt.interceptor.d.ts(3,28): error TS2307: Cannot find module 'rxjs/internal/Observable'.

I have isAuthenticated function in my service.

import { JwtHelperService } from '@auth0/angular-jwt';
import * as jwt_decode from 'jwt-decode';

@Injectable()
export class MembershipService{
    constructor(private http: Http,
       private mainService: MainService,
       public jwtHelper: JwtHelperService){}

    public isAuthenticated(): boolean {
        const token = localStorage.getItem('loggedToken');
        // Check whether the token is expired and return
        // true or false
        return !this.jwtHelper.isTokenExpired(token);

    }
}

Also my angular version is 5.0

I appreciate any help

like image 921
Mohammad Ali Avatar asked Oct 19 '25 04:10

Mohammad Ali


1 Answers

it sounds like this is a mismatch of RxJS versions. angular2-jwt v2 targets RxJS v6. For use with Angular v5 and RxJS v5, you should use angular2-jwt v1.

like image 122
Avinash Maurya Avatar answered Oct 20 '25 19:10

Avinash Maurya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!