Búsqueda de sitios web

angular - No se puede encontrar el módulo 'rxjs/internal/Observable'


Quiero usar el módulo JwtHelperService en mi servicio, pero obtuve el siguiente error:

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

Tengo la función isAuthenticated en mi servicio.

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);

    }
}

También mi versión de Angular es 5.0

Agradezco cualquier ayuda

Respuesta #1

parece que esto es una incompatibilidad de versiones de RxJS. angular2-jwt v2 apunta a RxJS v6. Para usar con Angular v5 y RxJS v5, deberías usar angular2-jwt v1.

Artículos relacionados