我需要将 html 转换为 pdf,我使用的是 jspdf 1.5.2。 它显示错误 Cannot read property 'charAt' of undefined (using with html2canvas)。
当我尝试安装 jspdf 1.5.3 时,我得到了这个:
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://git@github.com/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
我已经阅读了其他主题,但没有一个有帮助。
最佳答案
对于 jsPDF 的 1.5.3 版,他们直接使用来自 GitHUB 的依赖项。我假设您正在 CI 中运行构建?您要么安装 git + ssh,要么在那时返回到 jsPDF 的 1.5.2 版本。他们的错误跟踪器中有很多问题。这似乎是相关问题 https://github.com/MrRio/jsPDF/issues/2208 .它被标记为已修复,但到目前为止还没有新版本 1.5.4。
关于javascript - 无法安装 jspdf 1.5.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56440567/