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.

Angular build fails when using html2canvas with await/async

See original GitHub issue

Please make sure you are testing with the latest release of html2canvas. Old versions are not supported and issues reported for them will be closed.

Please follow the general troubleshooting steps first:

Bug reports:

When I run ng build to an Angular 7 application that uses html2canvas as:

const canvas = await html2canvas(el as HTMLElement, { useCORS: true });

I get the following error:

error TS2349: Cannot invoke an expression whose type lacks a call signature. Type ‘typeof import(“C:/my-app/node_modules/html2canvas/dist/types/index”)’ has no compatible call signatures.

Specifications:

  • html2canvas version tested with: 1.0.0-rc.2 - 1.0.0-rc.7
  • Browser & version:
  • Operating system: Windows 10

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:15

github_iconTop GitHub Comments

17reactions
AdditionAddictcommented, Jun 27, 2019

For those of us new to angular, if you’re on Angular 8 this means changing package.json "html2canvas": "1.0.0-rc.1" and then running npm i --verbose

3reactions
coolrbcommented, Jun 27, 2019

@AdditionAddict RC1 helped me to build successfully. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular using html2canvas and waiting until its completed ...
Yes, you can use async/await . This is how you change your code: part1() { const element = document.getElementById("capture") as ...
Read more >
html2canvas@1.0.0-rc.2 makes Angular project build failed ...
In the end, it failed. I guess it because of html2canvas@1.0.0-rc.2,maybe . Summary log: Node#moveTo was deprecated. Use Container#append.
Read more >
Html2Canvas With Angular Not Working As Intended - ADocLib
Old versions are not supported and issues reported for them will be closed. Please follow the Angular build fails when using html2canvas with...
Read more >
html2canvas - Bountysource
I'm using webkit brightness effect on canvas but while converting that canvas into new canvas these effects are not applied.. -webkit-filter: brightness(1.3); - ......
Read more >
use await in angular Code Example
private async fetchData(){ const data = await this.httpClient.get(this.apiUrl).toPromise(); console.log("Data: " + JSON.stringify(data)); }
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