Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install jspdf 1.5.3

I need to convert html to pdf and I am using jspdf 1.5.2. It shows the error Cannot read property 'charAt' of undefined (using with html2canvas).

When I try to install jspdf 1.5.3 I get this:

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/eligrey/FileSaver.js.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

I have read the other threads and none of them are helpful.

like image 942
Abdul Ahad Avatar asked Jun 04 '19 08:06

Abdul Ahad


2 Answers

With Version 1.5.3 of jsPDF they use a dependency directly from GitHUB. I'm assuming you're running the build in a CI? Either you install git + ssh or at that point return to version 1.5.2 of jsPDF. There's a bunch of issues in their bug tracker. This seems to be the relevant issue https://github.com/MrRio/jsPDF/issues/2208. It's marked fixed, but so far no new version 1.5.4.

like image 156
Grmpfhmbl Avatar answered Sep 19 '22 13:09

Grmpfhmbl


I had the same problem. I solved installing git.

like image 43
Natan Avatar answered Sep 18 '22 13:09

Natan