About design and nearby

Working with Angular: how to fix “Cannot find name ‘require'” issue

Posted: November 15th, 2017 | Author: | Filed under: Development, Tips and Tricks | Tags: , , | No Comments »

Sometimes building an app with Angular 4.. after including file in component and compiling, you can get such type of error:

Cannot find name ‘require’.

I have the following in one of my components:

angular component error issue

And it’s fixed by adding a magic line – to satisfy the Typescript compiler, you will need to tell it that System is an acceptable variable by declaring it:

declare var require: any;

angular 'require' fix

That’s it!

Share Button

Check Related Posts:


Leave a Reply


  • nine + 4 =

Looking for a Freelance UX & UI designer for your project? I’m ready to jump onboard!

Let's discuss your project now