auth0 / node-jwa

JSON Web Algorithms
http://tools.ietf.org/id/draft-ietf-jose-json-web-algorithms-08.html
MIT License
98 stars 42 forks source link

build error while using jsonwebtokens in Angular6 #25

Closed venkatesh-thatham closed 6 years ago

venkatesh-thatham commented 6 years ago

Hi,

After upgrade from Angular 5 to 6, I've been facing below issue while compiling.

[0] ERROR in ./node_modules/jwa/index.js [0] Module not found: Error: Can't resolve 'crypto' in 'node_modules\jwa' [0] ERROR in ./node_modules/jws/lib/sign-stream.js [0] Module not found: Error: Can't resolve 'stream' in 'node_modules\jws\lib' [0] ERROR in ./node_modules/jws/lib/verify-stream.js [0] Module not found: Error: Can't resolve 'stream' in 'node_modules\jws\lib' [0] ERROR in ./node_modules/jws/lib/data-stream.js [0] Module not found: Error: Can't resolve 'stream' in 'node_modules\jws\lib'

windivi commented 6 years ago

Me too.

omsmith commented 6 years ago

Try a fresh npm install, otherwise raise the issue with jsonwebtoken or angular.

venkatesh-thatham commented 6 years ago

finally, I've found a workaround, the error is from the @angular-devkit which is in node_modules.

I've modified the below file node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js

at the bottom of the page: node: false

Change to: node: { crypto: true, stream: true, buffer: true }

this might be a dirty fix, but really solved the problem

Thank you all for the time and effort

venkatesh-thatham commented 6 years ago

finally, I've found a workaround, the error is from the @angular-devkit which is in node_modules.

I've modified the below file node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js

at the bottom of the page: node: false

Change to: node: { crypto: true, stream: true, buffer: true }

this might be a dirty fix, but really solved the problem

Thank you all for the time and effort