[Solved] ReferenceError: KeyboardEvent is not defined

[Solved] ReferenceError: KeyboardEvent is not defined

This error happens due to lot of reasons.

In my case I was getting this error while making my angular site to angular universal site for server side rendering and better SEO.

But when I was trying to convert to angular universalĀ I got this “ReferenceError: KeyboardEvent is not defined ” issue.

In my case it was because of ngx-bootstrap component. In particular I used rating component from ngx-bootstrap and exactly in that module I got this error.

I just commented out those things and ran npm run start and it works fine.

And I came across a below link which actually suggests to built angular universal with ngx-bootstrap using webpack, details are at the below link,


But it did not work out for me at this time.

I also see similar issues with ngx-bootstrap for angular universal support in github issues section. Looks their new version resolves. If someone checked and it works fine, then keep updated in the below comments section to help someone. Else I will come back with the new posts.

787 total views, 5 views today

Leave a Reply

Your email address will not be published. Required fields are marked *