question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jwt.interceptor.d.ts & jwt.interceptor.js compile error

See original GitHub issue

Hey,

This is my first time creating an issue. I am currently using Angular 5 with this library.

Issue:

I am getting an error when I compile because of a reference to “rxjs/internal/Observable” in the jwt.interceptor.d.ts file.

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

Solution:

The solution I have for this to compile correctly using Angular 5 is to change that module reference in the jwt.interceptor.d.ts file from:

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

to:

import { Observable } from 'rxjs/observable';

and to change the module reference in jwt.interceptor.js from:

import { from } from "rxjs/internal/observable/from";

to:

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
chenkiecommented, May 20, 2018

Are you using version 2 of angular2-jwt? If so, 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.

5reactions
gibsonsydcommented, May 21, 2018

There is a compile error when using angular cli to build a project that has the angular2-jwt (npm 0.2.3) package reference:

Angular CLI: 6.0.3 Node: 8.9.4 OS: darwin x64 Angular: 6.0.2

`Package Version

@angular-devkit/architect 0.6.3 @angular-devkit/build-angular 0.6.3 @angular-devkit/build-optimizer 0.6.3 @angular-devkit/core 0.6.3 @angular-devkit/schematics 0.6.3 @angular/cli 6.0.3 @ngtools/webpack 6.0.3 @schematics/angular 0.6.3 @schematics/update 0.6.3 rxjs 6.1.0 typescript 2.7.2 webpack 4.8.3`

Build command: ng build proj production

Error:

ERROR in node_modules/@auth0/angular-jwt/src/jwt.interceptor.d.ts(3,10): error TS2305: Module '"/Users/.../site/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'.

https://github.com/ReactiveX/rxjs indicates that Observable should be imported from ‘rxjs’ not ‘rxjs/Observable’ as it is declared in ‘jwt.interceptor.d.js’.

**EDIT

the rxjs-compat library is required to fix this issue currently. If not installed when upgrading an existing project through npm upgrade, you can run:

sudo npm install rxjs-compat --save. This resolves the angular2-jwt issue when building the Angular 6 project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR in node_modules/@auth0/angular-jwt/lib/jwtoptions ...
When compiling my angular project, I get the following error. I deleted my node_modules file and reinstalled it still didn't work. ERROR in ......
Read more >
Angular 7 - JWT Authentication Example & Tutorial
The Error Interceptor intercepts http responses from the api to check if there were any errors. If there is a 401 Unauthorized response...
Read more >
@auth0/angular-jwt - npm
This library provides an HttpInterceptor which automatically attaches a JSON Web Token to HttpClient requests. This library does not have any ...
Read more >
How to Do JWT Authentication with an Angular 6 SPA - Toptal
send({token}); });. This is mostly basic JavaScript code. We get the JSON body that was passed to the /auth endpoint, find a user...
Read more >
Use gRPC interceptor for authorization with JWT
UnaryHandler, ) (interface{}, error) { log.Println("--> unary interceptor: ", info.FullMethod) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found