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.

ReferenceError: window is not defined (Angular 6 with dotnet core)

See original GitHub issue

Hello guys!

I’ve followed all the documentation guidelines, I’ve been looking for some solved issues, I’ve tried to correct this of many ways.

But I still can not use this lib in my application in Angular 6 with dotnet core.

When I install the lib (“jspdf”: “^1.4.1”) and try to use that, the application crashes with the error: “… window is not defined.”.

Error on debugger: captura de tela de 2018-08-23 11-14-57

Error on browser: captura de tela de 2018-08-23 11-15-50

My code:

...
import * as jsPDF from 'jspdf';
...
    ngOnInit(): void {

        let doc = new jsPDF({
            orientation: 'landscape',
            unit: 'in',
            format: [4, 2]
        });

        doc.text('Hello world!', 1, 1);
        doc.save('two-by-four.pdf');
   }
...

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
Uzlopakcommented, Aug 31, 2018

Duplicate of #1891

Will be fixed in 1.4.2

0reactions
Uzlopakcommented, Sep 10, 2018

11 issues to go… Unknown… when i fix every 2-3 days an issue in about 30 days it will be ready. But i have alot to o anyway… so more like 50 days or so…

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: window is not defined , angular6 universal
"window is not defined" came from 3rd party library which accessing window variable. You should wrapping your code ...
Read more >
window is not defined (Angular 6 with dotnet core ... - GitHub
When I install the lib ("jspdf": "^1.4.1") and try to use that, the application crashes with the error: "... window is not defined."....
Read more >
Angular Universal: ReferenceError: window is not defined
This error can be caused by a reference to the Window object if you are rendering your application from a server like Node.js....
Read more >
'Kendo is not defined' issue in UI for ASP.NET MVC - Telerik
Hi, Am getting 'Kendo is not defined' error while using date picker MVC UI control. Uncaught ReferenceError: kendo is not defined.
Read more >
Uncaught ReferenceError: Angular is not defined
In this article, we will see the “Uncaught ReferenceError: Angular is not defined”, along with knowing a possible way to resolve it.
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